mirror of https://github.com/tinygo-org/tinygo.git
wasmstm32webassemblymicrocontrollerarmavrspiwasiadafruitarduinocircuitplayground-expressgpioi2cllvmmicrobitnrf51nrf52nrf52840samd21tinygo
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
872 B
33 lines
872 B
package builder
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestSplitDepFile(t *testing.T) {
|
|
for i, tc := range []struct {
|
|
in string
|
|
out []string
|
|
}{
|
|
{`deps: foo bar`, []string{"foo", "bar"}},
|
|
{`deps: foo "bar"`, []string{"foo", "bar"}},
|
|
{`deps: "foo" bar`, []string{"foo", "bar"}},
|
|
{`deps: "foo bar"`, []string{"foo bar"}},
|
|
{`deps: "foo bar" `, []string{"foo bar"}},
|
|
{"deps: foo\nbar", []string{"foo"}},
|
|
{"deps: foo \\\nbar", []string{"foo", "bar"}},
|
|
{"deps: foo\\bar \\\nbaz", []string{"foo\\bar", "baz"}},
|
|
{"deps: foo\\bar \\\r\n baz", []string{"foo\\bar", "baz"}}, // Windows uses CRLF line endings
|
|
} {
|
|
out, err := parseDepFile(tc.in)
|
|
if err != nil {
|
|
t.Errorf("test #%d failed: %v", i, err)
|
|
continue
|
|
}
|
|
if !reflect.DeepEqual(out, tc.out) {
|
|
t.Errorf("test #%d failed: expected %#v but got %#v", i, tc.out, out)
|
|
continue
|
|
}
|
|
}
|
|
}
|
|
|