2020-09-03 13:48:39 +08:00
|
|
|
package eval_test
|
2019-10-23 05:49:32 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2021-01-27 09:28:38 +08:00
|
|
|
. "src.elv.sh/pkg/eval"
|
2020-09-03 13:48:39 +08:00
|
|
|
|
2021-01-27 09:28:38 +08:00
|
|
|
"src.elv.sh/pkg/tt"
|
2019-10-23 05:49:32 +08:00
|
|
|
)
|
|
|
|
|
2020-12-26 06:31:52 +08:00
|
|
|
func TestSplitSigil(t *testing.T) {
|
2024-01-11 23:42:43 +08:00
|
|
|
tt.Test(t, SplitSigil,
|
2019-10-23 05:49:32 +08:00
|
|
|
Args("").Rets("", ""),
|
|
|
|
Args("x").Rets("", "x"),
|
|
|
|
Args("@x").Rets("@", "x"),
|
|
|
|
Args("a:b").Rets("", "a:b"),
|
|
|
|
Args("@a:b").Rets("@", "a:b"),
|
2024-01-11 23:42:43 +08:00
|
|
|
)
|
2019-10-23 05:49:32 +08:00
|
|
|
}
|
|
|
|
|
2020-12-26 06:31:52 +08:00
|
|
|
func TestSplitQName(t *testing.T) {
|
2024-01-11 23:42:43 +08:00
|
|
|
tt.Test(t, SplitQName,
|
2019-10-23 05:49:32 +08:00
|
|
|
Args("").Rets("", ""),
|
2020-12-26 06:31:52 +08:00
|
|
|
Args("a").Rets("a", ""),
|
2019-10-23 05:49:32 +08:00
|
|
|
Args("a:").Rets("a:", ""),
|
|
|
|
Args("a:b").Rets("a:", "b"),
|
|
|
|
Args("a:b:").Rets("a:", "b:"),
|
|
|
|
Args("a:b:c").Rets("a:", "b:c"),
|
|
|
|
Args("a:b:c:").Rets("a:", "b:c:"),
|
2024-01-11 23:42:43 +08:00
|
|
|
)
|
2019-10-23 05:49:32 +08:00
|
|
|
}
|
|
|
|
|
2020-12-26 06:31:52 +08:00
|
|
|
func TestSplitQNameSegs(t *testing.T) {
|
2024-01-11 23:42:43 +08:00
|
|
|
tt.Test(t, SplitQNameSegs,
|
2019-10-23 05:49:32 +08:00
|
|
|
Args("").Rets([]string{}),
|
|
|
|
Args("a").Rets([]string{"a"}),
|
|
|
|
Args("a:").Rets([]string{"a:"}),
|
|
|
|
Args("a:b").Rets([]string{"a:", "b"}),
|
|
|
|
Args("a:b:").Rets([]string{"a:", "b:"}),
|
|
|
|
Args("a:b:c").Rets([]string{"a:", "b:", "c"}),
|
|
|
|
Args("a:b:c:").Rets([]string{"a:", "b:", "c:"}),
|
2024-01-11 23:42:43 +08:00
|
|
|
)
|
2019-10-23 05:49:32 +08:00
|
|
|
}
|
2020-12-26 06:31:52 +08:00
|
|
|
|
|
|
|
func TestSplitIncompleteQNameNs(t *testing.T) {
|
2024-01-11 23:42:43 +08:00
|
|
|
tt.Test(t, SplitIncompleteQNameNs,
|
2020-12-26 06:31:52 +08:00
|
|
|
Args("").Rets("", ""),
|
|
|
|
Args("a").Rets("", "a"),
|
|
|
|
Args("a:").Rets("a:", ""),
|
|
|
|
Args("a:b").Rets("a:", "b"),
|
|
|
|
Args("a:b:").Rets("a:b:", ""),
|
|
|
|
Args("a:b:c").Rets("a:b:", "c"),
|
|
|
|
Args("a:b:c:").Rets("a:b:c:", ""),
|
2024-01-11 23:42:43 +08:00
|
|
|
)
|
2020-12-26 06:31:52 +08:00
|
|
|
}
|