Add pixel text editor and built-in messages
This commit is contained in:
11 files changed
+1069
-11
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package pixel
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMessagesCoverBothLocales(t *testing.T) {
|
||||
for key := range messages[En] {
|
||||
if _, ok := messages[Zh][key]; !ok {
|
||||
t.Errorf("message %q missing in Chinese", key)
|
||||
}
|
||||
}
|
||||
for key := range messages[Zh] {
|
||||
if _, ok := messages[En][key]; !ok {
|
||||
t.Errorf("message %q missing in English", key)
|
||||
}
|
||||
}
|
||||
if got := (Kit{locale: Zh}).Msg("game_over"); got != "游戏结束" {
|
||||
t.Fatalf("Zh game_over = %q", got)
|
||||
}
|
||||
if got := (Kit{locale: En}).Msg("continue"); got != "CONTINUE?" {
|
||||
t.Fatalf("En continue = %q", got)
|
||||
}
|
||||
defer func() {
|
||||
if recover() == nil {
|
||||
t.Fatal("unknown message did not panic")
|
||||
}
|
||||
}()
|
||||
Kit{locale: En}.Msg("no_such_key")
|
||||
}
|
||||
Reference in new issue
Block a user