Write some more scope edge case tests.

This commit is contained in:
Bob Nystrom
2013-12-14 16:36:19 -08:00
parent 7fe60499db
commit f5e4f95069
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,2 @@
var a = a == null
io.write(a) // expect: true

View File

@ -0,0 +1,5 @@
// skip: Variables should not be in scope in their initializer.
{
var a = a + 1 // expect error
io.write(a)
}

View File

@ -0,0 +1,8 @@
{
var a = "outer"
{
io.write(a) // expect: outer
var a = "inner"
io.write(a) // expect: inner
}
}

View File

@ -0,0 +1,11 @@
// skip: Variables should not be in scope in their initializer.
{
var a = "outer"
{
var a = a + " inner"
io.write(a) // expect: outer inner
}
}
// TODO: Test referring to class name inside class for class at global scope
// and in local scope.