hare-xdg/locale/string_test.ha

29 lines
765 B
Hare
Raw Normal View History

2024-10-21 18:00:09 -06:00
@test fn string_resolve() void = {
assert(string_resolve([
(c, "c"),
(parse("xx_XX")!, "xx_XX"),
], c) as str == "c");
assert(string_resolve([
(c, "c"),
(parse("xx_XX")!, "xx_XX"),
], parse("xx_XX.UTF-8")!) as str == "xx_XX");
assert(string_resolve([
(c, "c"),
(parse("xx_XX")!, "xx_XX"),
(parse("xx_XX.UTF-8")!, "xx_XX2"),
], parse("xx_XX")!) as str == "xx_XX");
assert(string_resolve([
(c, "c"),
(parse("xx_XX")!, "xx_XX"),
(parse("xx_XX.UTF-8")!, "xx_XX2"),
], parse("xx_XX.UTF-8")!) as str == "xx_XX2");
2024-10-21 18:00:09 -06:00
assert(string_resolve([
(c, "c"),
(parse("xx_XX")!, "xx_XX"),
], parse("yy_YY.UTF-8")!) as str == "c");
assert(string_resolve([
(parse("xx_XX")!, "xx_XX"),
(parse("zz_ZZ")!, "zz_ZZ"),
], parse("yy_YY")!) is void);
};