-
Notifications
You must be signed in to change notification settings - Fork 57
/
gotext_test.go
709 lines (582 loc) · 19.2 KB
/
gotext_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
package gotext
import (
"os"
"path"
"path/filepath"
"sync"
"testing"
)
func TestGettersSetters(t *testing.T) {
SetDomain("test")
dom := GetDomain()
if dom != "test" {
t.Errorf("Expected GetDomain to return 'test', but got '%s'", dom)
}
SetLibrary("/tmp/test")
lib := GetLibrary()
if lib != "/tmp/test" {
t.Errorf("Expected GetLibrary to return '/tmp/test', but got '%s'", lib)
}
SetLanguage("es")
lang := GetLanguage()
if lang != "es" {
t.Errorf("Expected GetLanguage to return 'es', but got '%s'", lang)
}
// Create Locale with full language code
l := NewLocale("fixtures/", "fr_FR")
SetLocales([]*Locale{l})
locale := GetLocales()[0]
if locale != l {
t.Errorf("Expected GetLocale to return provided locale locale %v, but got '%v'", locale, l)
}
}
func TestPackageFunctions(t *testing.T) {
// Set PO content
str := `
msgid ""
msgstr "Project-Id-Version: %s\n"
"Report-Msgid-Bugs-To: %s\n"
# Initial comment
# More Headers below
"Language: en\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
# Some comment
msgid "My text"
msgstr "Translated text"
# More comments
msgid "Another string"
msgstr ""
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"
msgstr[2] "And this is the second plural form: %s"
msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"
msgid "Some random"
msgstr "Some random Translation"
msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random Translation in a context"
msgid "More"
msgstr "More Translation"
msgid "Untranslated"
msgid_plural "Several untranslated"
msgstr[0] ""
msgstr[1] ""
`
anotherStr := `
msgid ""
msgstr "Project-Id-Version: %s\n"
"Report-Msgid-Bugs-To: %s\n"
# Initial comment
# More Headers below
"Language: en\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Another text on a different domain"
msgstr "Another text on another domain"
`
// Create Locales directory on default location
dirname := path.Join("/tmp", "en_US")
err := os.MkdirAll(dirname, os.ModePerm)
if err != nil {
t.Fatalf("Can't create test directory: %s", err.Error())
}
// Write PO content to default domain file
filename := path.Join(dirname, "default.po")
f, err := os.Create(filename)
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
_, err = f.WriteString(str)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
anotherFilename := path.Join(dirname, "another.po")
af, err := os.Create(anotherFilename)
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
_, err = af.WriteString(anotherStr)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
// Move file close to write the file, so we can use it in the next step
f.Close()
af.Close()
// Set package configuration
Configure("/tmp", "en_US", "default")
// Test translations
tr := Get("My text")
if tr != translatedText {
t.Errorf("Expected '%s' but got '%s'", translatedText, tr)
}
v := "Variable"
tr = Get("One with var: %s", v)
if tr != "This one is the singular: Variable" {
t.Errorf("Expected 'This one is the singular: Variable' but got '%s'", tr)
}
// Test plural
tr = GetN("One with var: %s", "Several with vars: %s", 2, v)
if tr != "This one is the plural: Variable" {
t.Errorf("Expected 'This one is the plural: Variable' but got '%s'", tr)
}
// Test context translations
tr = GetC("Some random in a context", "Ctx")
if tr != "Some random Translation in a context" {
t.Errorf("Expected 'Some random Translation in a context' but got '%s'", tr)
}
v = "Variable"
tr = GetC("One with var: %s", "Ctx", v)
if tr != "This one is the singular in a Ctx context: Variable" {
t.Errorf("Expected 'This one is the singular in a Ctx context: Variable' but got '%s'", tr)
}
tr = GetNC("One with var: %s", "Several with vars: %s", 19, "Ctx", v)
if tr != "This one is the plural in a Ctx context: Variable" {
t.Errorf("Expected 'This one is the plural in a Ctx context: Variable' but got '%s'", tr)
}
tr = GetD("another", "Another text on a different domain")
if tr != "Another text on another domain" {
t.Errorf("Expected 'Another text on another domain' but got '%s'", tr)
}
// IsTranslated tests for when the string is translated in English.
if !IsTranslated("My text") {
t.Error("'My text' should be reported as translated when 'langs' is omitted.")
}
if !IsTranslated("My text", "en_US") {
t.Error("'My text' should be reported as translated when 'langs' is 'en_US'.")
}
if IsTranslated("My text", "cs_CZ") {
t.Error("'My text' should be reported as not translated when 'langs' is 'cs_CZ'.")
}
if !IsTranslated("My text", "en_US", "cs_CZ") {
t.Error("'My text' should be reported as translated when 'langs' is 'en_US, cs_CZ'.")
}
// IsTranslated tests for when the string is not translated in English
if IsTranslated("Another string") {
t.Error("'Another string' should be reported as not translated.")
}
if IsTranslated("String not in .po") {
t.Error("'String not in .po' should be reported as not translated.")
}
// IsTranslated tests for plurals and contexts
plural := "One with var: %s"
if !IsTranslated(plural) {
t.Errorf("'%s' should be reported as translated for singular.", plural)
}
if !IsTranslatedN(plural, 0) {
t.Errorf("'%s' should be reported as translated for n=0.", plural)
}
if !IsTranslatedN(plural, 2) {
t.Errorf("'%s' should be reported as translated for n=2.", plural)
}
if !IsTranslatedC("Some random in a context", "Ctx") {
t.Errorf("'Some random in a context' should be reported as translated under context.")
}
if !IsTranslatedC(plural, "Ctx") {
t.Errorf("'%s' should be reported as translated for singular under context.", plural)
}
if !IsTranslatedNC(plural, 0, "Ctx") {
t.Errorf("'%s' should be reported as translated for n=0 under context.", plural)
}
}
func TestUntranslated(t *testing.T) {
// Set PO content
str := `
msgid ""
msgstr ""
# Initial comment
# Headers below
"Language: en\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Untranslated"
msgid_plural "Several untranslated"
msgstr[0] ""
msgstr[1] ""
`
// Create Locales directory on default location
dirname := path.Join("/tmp", "en_US")
err := os.MkdirAll(dirname, os.ModePerm)
if err != nil {
t.Fatalf("Can't create test directory: %s", err.Error())
}
// Write PO content to default domain file
filename := path.Join(dirname, "default.po")
f, err := os.Create(filename)
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
defer f.Close()
_, err = f.WriteString(str)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
// Set package configuration
Configure("/tmp", "en_US", "default")
// Test untranslated
tr := Get("Untranslated")
if tr != "Untranslated" {
t.Errorf("Expected 'Untranslated' but got '%s'", tr)
}
tr = GetN("Untranslated", "Several untranslated", 1)
if tr != "Untranslated" {
t.Errorf("Expected 'Untranslated' but got '%s'", tr)
}
tr = GetN("Untranslated", "Several untranslated", 2)
if tr != "Several untranslated" {
t.Errorf("Expected 'Several untranslated' but got '%s'", tr)
}
tr = GetD("default", "Untranslated")
if tr != "Untranslated" {
t.Errorf("Expected 'Untranslated' but got '%s'", tr)
}
tr = GetND("default", "Untranslated", "Several untranslated", 1)
if tr != "Untranslated" {
t.Errorf("Expected 'Untranslated' but got '%s'", tr)
}
tr = GetND("default", "Untranslated", "Several untranslated", 2)
if tr != "Several untranslated" {
t.Errorf("Expected 'Several untranslated' but got '%s'", tr)
}
}
func TestMoAndPoTranslator(t *testing.T) {
fixPath, _ := filepath.Abs("./fixtures/")
Configure(fixPath, "en_GB", "default")
// Check default domain Translation
SetDomain("default")
tr := Get("My text")
if tr != translatedText {
t.Errorf("Expected '%s'. Got '%s'", translatedText, tr)
}
tr = Get("language")
if tr != "en_GB" {
t.Errorf("Expected 'en_GB'. Got '%s'", tr)
}
// Change Language (locale)
SetLanguage("en_AU")
// Check default domain Translation
SetDomain("default")
tr = Get("My text")
if tr != translatedText {
t.Errorf("Expected '%s'. Got '%s'", translatedText, tr)
}
tr = Get("language")
if tr != "en_AU" {
t.Errorf("Expected 'en_AU'. Got '%s'", tr)
}
}
func TestDomains(t *testing.T) {
// Set PO content
strDefault := `
msgid ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Default text"
msgid_plural "Default texts"
msgstr[0] "Default Translation"
msgstr[1] "Default translations"
msgctxt "Ctx"
msgid "Default context"
msgid_plural "Default contexts"
msgstr[0] "Default ctx Translation"
msgstr[1] "Default ctx translations"
`
strCustom := `
msgid ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Custom text"
msgid_plural "Custom texts"
msgstr[0] "Custom Translation"
msgstr[1] "Custom translations"
msgctxt "Ctx"
msgid "Custom context"
msgid_plural "Custom contexts"
msgstr[0] "Custom ctx Translation"
msgstr[1] "Custom ctx translations"
`
// Create Locales directory and files on temp location
dirname := path.Join("/tmp", "en_US")
err := os.MkdirAll(dirname, os.ModePerm)
if err != nil {
t.Fatalf("Can't create test directory: %s", err.Error())
}
fDefault, err := os.Create(path.Join(dirname, "default.po"))
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
defer fDefault.Close()
fCustom, err := os.Create(path.Join(dirname, "custom.po"))
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
defer fCustom.Close()
_, err = fDefault.WriteString(strDefault)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
_, err = fCustom.WriteString(strCustom)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
Configure("/tmp", "en_US", "default")
// Check default domain Translation
SetDomain("default")
tr := Get("Default text")
if tr != "Default Translation" {
t.Errorf("Expected 'Default Translation'. Got '%s'", tr)
}
tr = GetN("Default text", "Default texts", 23)
if tr != "Default translations" {
t.Errorf("Expected 'Default translations'. Got '%s'", tr)
}
tr = GetC("Default context", "Ctx")
if tr != "Default ctx Translation" {
t.Errorf("Expected 'Default ctx Translation'. Got '%s'", tr)
}
tr = GetNC("Default context", "Default contexts", 23, "Ctx")
if tr != "Default ctx translations" {
t.Errorf("Expected 'Default ctx translations'. Got '%s'", tr)
}
SetDomain("custom")
tr = Get("Custom text")
if tr != "Custom Translation" {
t.Errorf("Expected 'Custom Translation'. Got '%s'", tr)
}
tr = GetN("Custom text", "Custom texts", 23)
if tr != "Custom translations" {
t.Errorf("Expected 'Custom translations'. Got '%s'", tr)
}
tr = GetC("Custom context", "Ctx")
if tr != "Custom ctx Translation" {
t.Errorf("Expected 'Custom ctx Translation'. Got '%s'", tr)
}
tr = GetNC("Custom context", "Custom contexts", 23, "Ctx")
if tr != "Custom ctx translations" {
t.Errorf("Expected 'Custom ctx translations'. Got '%s'", tr)
}
}
func TestOverrideLocale(t *testing.T) {
// Configure global translation
Configure("fixtures/", "de_DE", "default")
language := Get("language")
if language != "de_DE" {
t.Errorf("Expected default configuration to be 'de_DE' but got '%s'", language)
}
// Create and override with our new locale.
l := NewLocale("fixtures/", "fr")
l.SetDomain("default")
SetLocales([]*Locale{l})
language = Get("language")
if language != "fr" {
t.Errorf("Expected default configuration to be overriden by locale 'fr' but got '%s'", language)
}
// Ensure properties were applied on global configuration when Set.
dom := GetDomain()
if dom != "default" {
t.Errorf("Expected GetDomain to return 'default', but got '%s'", dom)
}
lib := GetLibrary()
if lib != "fixtures/" {
t.Errorf("Expected GetLibrary to return 'fixtures/', but got '%s'", lib)
}
lang := GetLanguage()
if lang != "fr" {
t.Errorf("Expected GetLanguage to return 'fr', but got '%s'", lang)
}
}
func TestPackageRace(t *testing.T) {
// Set PO content
str := `# Some comment
msgid "My text"
msgstr "Translated text"
# More comments
msgid "Another string"
msgstr ""
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"
msgstr[2] "And this is the second plural form: %s"
msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random Translation in a context"
`
// Create Locales directory on default location
dirname := path.Join("/tmp", "en_US")
err := os.MkdirAll(dirname, os.ModePerm)
if err != nil {
t.Fatalf("Can't create test directory: %s", err.Error())
}
// Write PO content to default domain file
filename := path.Join("/tmp", GetDomain()+".po")
f, err := os.Create(filename)
if err != nil {
t.Fatalf("Can't create test file: %s", err.Error())
}
defer f.Close()
_, err = f.WriteString(str)
if err != nil {
t.Fatalf("Can't write to test file: %s", err.Error())
}
var wg sync.WaitGroup
for i := 0; i < 1000; i++ {
wg.Add(1)
// Test translations
go func() {
defer wg.Done()
GetLibrary()
SetLibrary(path.Join("/tmp", "gotextlib"))
GetDomain()
SetDomain("default")
GetLanguage()
SetLanguage("en_US")
Configure("/tmp", "en_US", "default")
Get("My text")
GetN("One with var: %s", "Several with vars: %s", 0, "test")
GetC("Some random in a context", "Ctx")
}()
}
wg.Wait()
}
func TestPackageArabicTranslation(t *testing.T) {
Configure("fixtures/", "ar", "categories")
// Plurals formula missing + Plural translation string missing
tr := GetD("categories", "Alcohol & Tobacco")
if tr != "الكحول والتبغ" {
t.Errorf("Expected to get 'الكحول والتبغ', but got '%s'", tr)
}
// Plural translation string present without translations, should get the msgid_plural
tr = GetND("categories", "%d selected", "%d selected", 10)
if tr != "%d selected" {
t.Errorf("Expected to get '%%d selected', but got '%s'", tr)
}
// Plurals formula present + Plural translation string present and complete
tr = GetND("categories", "Load %d more document", "Load %d more documents", 0)
if tr != "حمّل %d مستندات إضافيّة" {
t.Errorf("Expected to get 'msgstr[0]', but got '%s'", tr)
}
tr = GetND("categories", "Load %d more document", "Load %d more documents", 1)
if tr != "حمّل مستند واحد إضافي" {
t.Errorf("Expected to get 'msgstr[1]', but got '%s'", tr)
}
tr = GetND("categories", "Load %d more document", "Load %d more documents", 2)
if tr != "حمّل مستندين إضافيين" {
t.Errorf("Expected to get 'msgstr[2]', but got '%s'", tr)
}
tr = GetND("categories", "Load %d more document", "Load %d more documents", 6)
if tr != "حمّل %d مستندات إضافيّة" {
t.Errorf("Expected to get 'msgstr[3]', but got '%s'", tr)
}
tr = GetND("categories", "Load %d more document", "Load %d more documents", 116)
if tr != "حمّل %d مستندا إضافيّا" {
t.Errorf("Expected to get 'msgstr[4]', but got '%s'", tr)
}
tr = GetND("categories", "Load %d more document", "Load %d more documents", 102)
if tr != "حمّل %d مستند إضافي" {
t.Errorf("Expected to get 'msgstr[5]', but got '%s'", tr)
}
}
func TestPackageArabicMissingPluralForm(t *testing.T) {
Configure("fixtures/", "ar", "no_plural_header")
// Get translation
tr := GetD("no_plural_header", "Alcohol & Tobacco")
if tr != "الكحول والتبغ" {
t.Errorf("Expected to get 'الكحول والتبغ', but got '%s'", tr)
}
}
func BenchmarkGoText(b *testing.B) {
l := NewLocale("fixtures", "de_DE")
l.AddDomain("default")
l.SetDomain("default")
d := l.Domains["default"].(AppendTranslator)
b.ResetTimer()
b.Run("strings", func(b *testing.B) {
for i := 0; i < b.N; i++ {
tr := d.Get("My text")
if tr != "Translated text" {
b.Errorf("Expected to get 'Translated text', but got '%s'", tr)
}
tr = d.Get("Some random")
if tr != "Some random translation" {
b.Errorf("Expected to get 'Some random translation', but got '%s'", tr)
}
tr = d.Get("More")
if tr != "More translation" {
b.Errorf("Expected to get 'More translation', but got '%s'", tr)
}
tr = d.Get("Multi-line")
if tr != "Multi \nline" {
b.Errorf("Expected to get 'Multi \nline', but got '%s'", tr)
}
tr = d.Get("Another string")
if tr != "Another string" {
b.Errorf("Expected to get 'Another string', but got '%s'", tr)
}
tr = d.GetN("One with var: %s", "Several with vars: %s", 1, "1")
if tr != "This one is the singular: 1" {
b.Errorf("Expected to get 'This one is the singular: 1', but got '%s'", tr)
}
tr = d.GetN("One with var: %s", "Several with vars: %s", 2, "2")
if tr != "This one is the plural: 2" {
b.Errorf("Expected to get 'This one is the plural: 2', but got '%s'", tr)
}
tr = d.GetN("Empty plural form singular", "Empty plural form", 1)
if tr != "Singular translated" {
b.Errorf("Expected to get 'Singular translated', but got '%s'", tr)
}
tr = d.GetNC("One with var: %s", "Several with vars: %s", 1, "Ctx", "1")
if tr != "This one is the singular in a Ctx context: 1" {
b.Errorf("Expected to get This one is the singular in a Ctx context: 1', but got '%s'", tr)
}
}
})
p := make([]byte, 256)
b.Run("byte-slices", func(b *testing.B) {
for i := 0; i < b.N; i++ {
tr := d.Append(p[:0], "My text")
if string(tr) != "Translated text" {
b.Errorf("Expected to get 'Translated text', but got '%s'", tr)
}
tr = d.Append(p[:0], "Some random")
if string(tr) != "Some random translation" {
b.Errorf("Expected to get 'Some random translation', but got '%s'", tr)
}
tr = d.Append(p[:0], "More")
if string(tr) != "More translation" {
b.Errorf("Expected to get 'More translation', but got '%s'", tr)
}
tr = d.Append(p[:0], "Multi-line")
if string(tr) != "Multi \nline" {
b.Errorf("Expected to get 'Multi \nline', but got '%s'", tr)
}
tr = d.Append(p[:0], "Another string")
if string(tr) != "Another string" {
b.Errorf("Expected to get 'Another string', but got '%s'", tr)
}
tr = d.AppendN(p[:0], "One with var: %s", "Several with vars: %s", 1, "1")
if string(tr) != "This one is the singular: 1" {
b.Errorf("Expected to get 'This one is the singular: 1', but got '%s'", tr)
}
tr = d.AppendN(p[:0], "One with var: %s", "Several with vars: %s", 2, "2")
if string(tr) != "This one is the plural: 2" {
b.Errorf("Expected to get 'This one is the plural: 2', but got '%s'", tr)
}
tr = d.AppendN(p[:0], "Empty plural form singular", "Empty plural form", 1)
if string(tr) != "Singular translated" {
b.Errorf("Expected to get 'Singular translated', but got '%s'", tr)
}
tr = d.AppendNC(p[:0], "One with var: %s", "Several with vars: %s", 1, "Ctx", "1")
if string(tr) != "This one is the singular in a Ctx context: 1" {
b.Errorf("Expected to get This one is the singular in a Ctx context: 1', but got '%s'", tr)
}
}
})
}