parent
74717609ec
commit
37050f3d87
|
|
@ -1,6 +1,7 @@
|
||||||
package v01
|
package v01
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -49,3 +50,43 @@ func TestV01TransformationPipe(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestV01Quiet(t *testing.T) {
|
||||||
|
ctx, can := context.WithCancel(context.Background())
|
||||||
|
defer can()
|
||||||
|
v01 := NewV01(ctx, constSrc(`{"Y":"a", "N":"b"}`))
|
||||||
|
|
||||||
|
v01.cfg.Quiet = false
|
||||||
|
if got := v01.Read(); len(got) != 2 {
|
||||||
|
t.Error(len(got))
|
||||||
|
} else if got[0].Char != 'a' {
|
||||||
|
t.Error(got[0].Char)
|
||||||
|
} else if got[0].Down != true {
|
||||||
|
t.Error(got[0].Down)
|
||||||
|
} else if got[1].Char != 'b' {
|
||||||
|
t.Error(got[1].Char)
|
||||||
|
} else if got[1].Down != false {
|
||||||
|
t.Error(got[1].Down)
|
||||||
|
}
|
||||||
|
|
||||||
|
v01.cfg.Quiet = true
|
||||||
|
if got := v01.Read(); len(got) != 2 {
|
||||||
|
t.Error(len(got))
|
||||||
|
} else if got[0].Char != 'a' {
|
||||||
|
t.Error(got[0].Char)
|
||||||
|
} else if got[0].Down != false {
|
||||||
|
t.Error(got[0].Down)
|
||||||
|
} else if got[1].Char != 'b' {
|
||||||
|
t.Error(got[1].Char)
|
||||||
|
} else if got[1].Down != false {
|
||||||
|
t.Error(got[1].Down)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type constSrc string
|
||||||
|
|
||||||
|
func (c constSrc) Close() {}
|
||||||
|
|
||||||
|
func (c constSrc) Read() []byte {
|
||||||
|
return []byte(c)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue