mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
71cd3835bc
Qualified imports of pkg/tt outnumber unqualified (27 to 24). Improve consistency, and clarity, by changing the dot (unqualified) imports of that package symbols to qualified.
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package eval_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "src.elv.sh/pkg/eval"
|
|
|
|
"src.elv.sh/pkg/tt"
|
|
)
|
|
|
|
func TestSplitSigil(t *testing.T) {
|
|
tt.Test(t, tt.Fn("SplitSigil", SplitSigil), tt.Table{
|
|
Args("").Rets("", ""),
|
|
Args("x").Rets("", "x"),
|
|
Args("@x").Rets("@", "x"),
|
|
Args("a:b").Rets("", "a:b"),
|
|
Args("@a:b").Rets("@", "a:b"),
|
|
})
|
|
}
|
|
|
|
func TestSplitQName(t *testing.T) {
|
|
tt.Test(t, tt.Fn("SplitQName", SplitQName), tt.Table{
|
|
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:"),
|
|
})
|
|
}
|
|
|
|
func TestSplitQNameSegs(t *testing.T) {
|
|
tt.Test(t, tt.Fn("SplitQNameSegs", SplitQNameSegs), tt.Table{
|
|
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:"}),
|
|
})
|
|
}
|
|
|
|
func TestSplitIncompleteQNameNs(t *testing.T) {
|
|
tt.Test(t, tt.Fn("SplitIncompleteQNameNs", SplitIncompleteQNameNs), tt.Table{
|
|
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:", ""),
|
|
})
|
|
}
|