nswrap/ast/util_test.go

24 lines
550 B
Go
Raw Normal View History

2019-06-04 00:14:04 -04:00
package ast
import (
"testing"
)
func TestRemoveQuotes(t *testing.T) {
t.Run("RemoveQuotes1", func(t *testing.T) {
2019-06-04 00:14:04 -04:00
if removeQuotes(`''`) != "" {
t.Errorf("Empty single quoted string test failed\n")
}
})
t.Run("RemoveQuotes2", func(t *testing.T) {
2019-06-04 00:14:04 -04:00
if removeQuotes(`"hi there"`) != `hi there` {
t.Errorf("Double quoted string test failed: %s -> %s\n", `"hi there"`, removeQuotes(`"hi there"`))
2019-06-04 00:14:04 -04:00
}
})
t.Run("TypesTree", func(t *testing.T) {
if typesTree(nil, 0) != "" {
2019-06-04 00:14:04 -04:00
t.Errorf(`typesTree(nil,0) did not return ""`)
}
})
}