| 1 | package vt100scip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/ |
| 2 | |
| 3 | import ( |
| 4 | "ioscip-go gomod github.com/golang/go/src go1.14 io/" |
| 5 | "stringsscip-go gomod github.com/golang/go/src go1.14 strings/" |
| 6 | "testingscip-go gomod github.com/golang/go/src go1.14 testing/" |
| 7 | |
| 8 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/" |
| 9 | ) |
| 10 | |
| 11 | func TestScanscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/TestScan().(t *testingscip-go gomod github.com/golang/go/src go1.14 testing/.Tscip-go gomod github.com/golang/go/src go1.14 testing/T#) { |
| 12 | nextCase: |
| 13 | for _, testCase := range []struct { |
| 14 | in string |
| 15 | want []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command# |
| 16 | }{ |
| 17 | {"fÜ", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{ |
| 18 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('f'), |
| 19 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('Ü'), |
| 20 | }}, |
| 21 | {"\u001babc", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{ |
| 22 | escapeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/escapeCommand#{'a', ""}, |
| 23 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('b'), |
| 24 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('c'), |
| 25 | }}, |
| 26 | {"\u001b[123;31d", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{escapeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/escapeCommand#{'d', "123;31"}}}, |
| 27 | {"\u009b123;31d", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{escapeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/escapeCommand#{'d', "123;31"}}}, |
| 28 | {"\u001b123", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{ |
| 29 | escapeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/escapeCommand#{'1', ""}, |
| 30 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('2'), |
| 31 | runeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/runeCommand#('3'), |
| 32 | }}, |
| 33 | {"\u001b[12;\"asd\"s", []Commandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Command#{ |
| 34 | escapeCommandscip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/escapeCommand#{'s', `12;"asd"`}, |
| 35 | }}, |
| 36 | } { |
| 37 | s := stringsscip-go gomod github.com/golang/go/src go1.14 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.14 strings/NewReader().(testCase.in) |
| 38 | |
| 39 | for i := 0; i < len(testCase.want); i++ { |
| 40 | got, err := Decodescip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Decode().(s) |
| 41 | if err == ioscip-go gomod github.com/golang/go/src go1.14 io/.EOFscip-go gomod github.com/golang/go/src go1.14 io/EOF. { |
| 42 | t.Errorscip-go gomod github.com/golang/go/src go1.14 testing/common#Error().("unexpected eof") |
| 43 | continue nextCase |
| 44 | } |
| 45 | |
| 46 | if !assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/Nil().(t, err, "unexpected error") { |
| 47 | continue |
| 48 | } |
| 49 | |
| 50 | assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/Equal().(t, testCase.want[i], got) |
| 51 | } |
| 52 | _, err := Decodescip-go gomod github.com/jaguilar/vt100 . `github.com/jaguilar/vt100`/Decode().(s) |
| 53 | assertscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.6.1 `github.com/stretchr/testify/assert`/Equal().(t, err, ioscip-go gomod github.com/golang/go/src go1.14 io/.EOFscip-go gomod github.com/golang/go/src go1.14 io/EOF.) |
| 54 | } |
| 55 | } |