converted the tests to use optional parentheses -- lot's of little subtleties to work out

This commit is contained in:
Jeremy Ashkenas
2010-01-24 23:40:45 -05:00
parent 70e3a6ef2f
commit a5d39efdd2
25 changed files with 106 additions and 101 deletions

View File

@@ -12,7 +12,7 @@ a: null
a ?= 10
b ?= 10
print(a is 10 and b is 10)
print a is 10 and b is 10
# The existential operator.
@@ -20,7 +20,7 @@ print(a is 10 and b is 10)
z: null
x: z ? "EX"
print(z is null and x is "EX")
print z is null and x is "EX"
# Only evaluate once.
@@ -39,17 +39,17 @@ obj: {
prop: "hello"
}
print(obj?.prop is "hello")
print obj?.prop is "hello"
print(obj?.prop?.non?.existent?.property is undefined)
print obj?.prop?.non?.existent?.property is undefined
# Soaks and caches method calls as well.
arr: ["--", "----"]
print(arr.pop()?.length is 4)
print(arr.pop()?.length is 2)
print(arr.pop()?.length is undefined)
print(arr[0]?.length is undefined)
print(arr.pop()?.length?.non?.existent()?.property is undefined)
print arr.pop()?.length is 4
print arr.pop()?.length is 2
print arr.pop()?.length is undefined
print arr[0]?.length is undefined
print arr.pop()?.length?.non?.existent()?.property is undefined