1
0
Fork 0

removed broken ru language

This commit is contained in:
ston1th 2021-01-14 09:19:40 +01:00
commit 97131cb577
10 changed files with 174 additions and 23 deletions

View file

@ -15,7 +15,11 @@ REM Hello World
`)
out = new(bytes.Buffer)
)
err := NewEncoder(out, "de").Encode(in)
e, err := NewEncoder(out, "de")
if err != nil {
t.Error(err)
}
err = e.Encode(in)
if err != nil {
t.Error(err)
}
@ -34,7 +38,11 @@ STRING Hello World
0x12, 0x0, 0x2c, 0x0, 0x1a, 0x2, 0x12, 0x0,
0x15, 0x0, 0xf, 0x0, 0x7, 0x0}
)
err := NewEncoder(out, "de").Encode(in)
e, err := NewEncoder(out, "de")
if err != nil {
t.Error(err)
}
err = e.Encode(in)
if err != nil {
t.Error(err)
}
@ -68,7 +76,11 @@ STRING Hello World
0xf, 0x0, 0x12, 0x0, 0x2c, 0x0, 0x1a, 0x2,
0x12, 0x0, 0x15, 0x0, 0xf, 0x0, 0x7, 0x0}
)
err := NewEncoder(out, "de").Encode(in)
e, err := NewEncoder(out, "de")
if err != nil {
t.Error(err)
}
err = e.Encode(in)
if err != nil {
t.Error(err)
}
@ -77,6 +89,18 @@ STRING Hello World
}
}
func TestError(t *testing.T) {
out := new(bytes.Buffer)
_, err := NewEncoder(out, "")
if err == nil {
t.Error("language '' should not be supported")
}
_, err = NewEncoder(out, "fizzbuzz")
if err == nil {
t.Error("language 'fizzbuzz' should not be supported")
}
}
func BenchmarkExample(b *testing.B) {
var in = bytes.NewBufferString(`
REM Type Hello World into Windows notepad. Target: Windows 95 and beyond. Author: Darren
@ -88,7 +112,10 @@ ENTER
DELAY 1000
STRING Hello World
`)
e := NewEncoder(ioutil.Discard, "de")
e, err := NewEncoder(ioutil.Discard, "de")
if err != nil {
b.Error(err)
}
b.ReportAllocs()
for i := 0; i < b.N; i++ {
e.Encode(in)