mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
pkg/eval: Add more test for variable use.
This commit is contained in:
parent
6189fd372f
commit
2e74150dda
|
@ -43,11 +43,15 @@ func TestCompileValue(t *testing.T) {
|
|||
// Variable Use
|
||||
// ------------
|
||||
|
||||
That("x = foo", "put $x").Puts("foo"),
|
||||
// Must exist before use
|
||||
That("put $x").DoesNotCompile(),
|
||||
That("put $x[0]").DoesNotCompile(),
|
||||
// Compounding
|
||||
That("x='SHELL'\nput 'WOW, SUCH '$x', MUCH COOL'\n").
|
||||
That("x = SHELL", "put 'WOW, SUCH '$x', MUCH COOL'\n").
|
||||
Puts("WOW, SUCH SHELL, MUCH COOL"),
|
||||
// Splicing
|
||||
That("x=[elvish rules]; put $@x").Puts("elvish", "rules"),
|
||||
That("x = [elvish rules]", "put $@x").Puts("elvish", "rules"),
|
||||
|
||||
// Variable namespace
|
||||
// ------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user