@@ -40,49 +40,49 @@ func TestI18n(t *testing.T) {
40
40
41
41
e := httptest .New (t , app )
42
42
// default should be en-US.
43
- e .GET ("/" ).Expect ().Status (httptest .StatusOK ).Body ().Equal (tests ["en-US" ])
43
+ e .GET ("/" ).Expect ().Status (httptest .StatusOK ).Body ().IsEqual (tests ["en-US" ])
44
44
45
45
for lang , body := range tests {
46
46
e .GET ("/" ).WithQueryString ("lang=" + lang ).Expect ().Status (httptest .StatusOK ).
47
- Body ().Equal (body )
47
+ Body ().IsEqual (body )
48
48
49
49
// test lowercase.
50
50
e .GET ("/" ).WithQueryString ("lang=" + strings .ToLower (lang )).Expect ().Status (httptest .StatusOK ).
51
- Body ().Equal (body )
51
+ Body ().IsEqual (body )
52
52
53
53
// test first part (e.g. en instead of en-US).
54
54
langFirstPart := strings .Split (lang , "-" )[0 ]
55
55
e .GET ("/" ).WithQueryString ("lang=" + langFirstPart ).Expect ().Status (httptest .StatusOK ).
56
- Body ().Equal (body )
56
+ Body ().IsEqual (body )
57
57
58
58
// test accept-language header prefix (i18n wrapper).
59
59
e .GET ("/" + lang ).WithHeader ("Accept-Language" , lang ).Expect ().Status (httptest .StatusOK ).
60
- Body ().Equal (body )
60
+ Body ().IsEqual (body )
61
61
62
62
// test path prefix (i18n router wrapper).
63
63
e .GET ("/" + lang ).Expect ().Status (httptest .StatusOK ).
64
- Body ().Equal (body )
64
+ Body ().IsEqual (body )
65
65
66
66
// test path prefix with first part.
67
67
e .GET ("/" + langFirstPart ).Expect ().Status (httptest .StatusOK ).
68
- Body ().Equal (body )
68
+ Body ().IsEqual (body )
69
69
}
70
70
71
71
e .GET ("/other" ).WithQueryString ("lang=el-GR" ).Expect ().Status (httptest .StatusOK ).
72
- Body ().Equal (elgrMulti )
72
+ Body ().IsEqual (elgrMulti )
73
73
e .GET ("/other" ).WithQueryString ("lang=en-US" ).Expect ().Status (httptest .StatusOK ).
74
- Body ().Equal (enusMulti )
74
+ Body ().IsEqual (enusMulti )
75
75
76
76
// test path prefix (i18n router wrapper).
77
77
e .GET ("/el-gr/other" ).Expect ().Status (httptest .StatusOK ).
78
- Body ().Equal (elgrMulti )
78
+ Body ().IsEqual (elgrMulti )
79
79
e .GET ("/en/other" ).Expect ().Status (httptest .StatusOK ).
80
- Body ().Equal (enusMulti )
80
+ Body ().IsEqual (enusMulti )
81
81
82
82
e .GET ("/el-GRtemplates" ).Expect ().Status (httptest .StatusNotFound )
83
83
e .GET ("/el-templates" ).Expect ().Status (httptest .StatusNotFound )
84
84
85
85
e .GET ("/el/templates" ).Expect ().Status (httptest .StatusOK ).Body ().Contains (elGR ).Contains (zhCN )
86
86
87
- e .GET ("/not-matched" ).WithQuery ("lang" , "en-gb" ).Expect ().Status (httptest .StatusOK ).Body ().Equal ("user language input: en-gb: matched as: en-US: not found key: not_found_key: args: [some values 42]" )
87
+ e .GET ("/not-matched" ).WithQuery ("lang" , "en-gb" ).Expect ().Status (httptest .StatusOK ).Body ().IsEqual ("user language input: en-gb: matched as: en-US: not found key: not_found_key: args: [some values 42]" )
88
88
}
0 commit comments