diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-11-16 19:28:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-16 19:28:52 -0500 |
commit | 0135904f7d3e1c0e763adaefe267c736616e3d26 (patch) | |
tree | c27be7588f98eaea62e0bd0c0087f2b348da9738 /vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go | |
parent | 0b296dd8c2aefefe89787be5cc627d44cf431150 (diff) | |
download | chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.gz chat-0135904f7d3e1c0e763adaefe267c736616e3d26.tar.bz2 chat-0135904f7d3e1c0e763adaefe267c736616e3d26.zip |
Upgrading server dependancies (#4566)
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go')
-rw-r--r-- | vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go new file mode 100644 index 000000000..43dea3f38 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/constants_command_test.go @@ -0,0 +1,42 @@ +package main + +import "testing" + +func TestConstantsExecute(t *testing.T) { + resetDir(t, "testdata/output") + + cc := &constantsCommand{ + translationFiles: []string{"testdata/input/en-us.constants.json"}, + packageName: "R", + outdir: "testdata/output", + } + + if err := cc.execute(); err != nil { + t.Fatal(err) + } + + expectEqualFiles(t, "testdata/output/R.go", "testdata/expected/R.go") +} + +func TestToCamelCase(t *testing.T) { + expectEqual := func(test, expected string) { + result := toCamelCase(test) + if result != expected { + t.Fatalf("failed toCamelCase the test %s was expected %s but the result was %s", test, expected, result) + } + } + + expectEqual("", "") + expectEqual("a", "A") + expectEqual("_", "") + expectEqual("__code__", "Code") + expectEqual("test", "Test") + expectEqual("test_one", "TestOne") + expectEqual("test.two", "TestTwo") + expectEqual("test_alpha_beta", "TestAlphaBeta") + expectEqual("word word", "WordWord") + expectEqual("test_id", "TestID") + expectEqual("tcp_name", "TCPName") + expectEqual("こんにちは", "こんにちは") + expectEqual("test_a", "TestA") +} |