Skip to content
Browse files

Tests are changed to match TinyAstParser output.

  • Loading branch information...
1 parent 7d53f71 commit b152e54e2482b89c1f696669bb4f5c2e046c865d @MaximTrushin committed Jan 21, 2012
Showing with 79 additions and 145 deletions.
  1. +2 −2 tests/testcases/roundtrip/arrays-1.boo
  2. +4 −4 tests/testcases/roundtrip/arrays-2.boo
  3. +4 −3 tests/testcases/roundtrip/arrays-3.boo
  4. +1 −1 tests/testcases/roundtrip/arrays-5.boo
  5. +5 −5 tests/testcases/roundtrip/as-1.boo
  6. +1 −1 tests/testcases/roundtrip/assignment-1.boo
  7. +0 −1 tests/testcases/roundtrip/ast-literal-enum.boo
  8. +5 −14 tests/testcases/roundtrip/ast-literals-1.boo
  9. +3 −3 tests/testcases/roundtrip/ast-literals-10.boo
  10. +4 −11 tests/testcases/roundtrip/ast-literals-11.boo
  11. +2 −2 tests/testcases/roundtrip/ast-literals-2.boo
  12. +3 −3 tests/testcases/roundtrip/ast-literals-3.boo
  13. +3 −9 tests/testcases/roundtrip/ast-literals-4.boo
  14. +0 −1 tests/testcases/roundtrip/ast-literals-5.boo
  15. +1 −5 tests/testcases/roundtrip/ast-literals-6.boo
  16. +1 −8 tests/testcases/roundtrip/ast-literals-7.boo
  17. +2 −6 tests/testcases/roundtrip/ast-literals-8.boo
  18. +2 −3 tests/testcases/roundtrip/ast-literals-9.boo
  19. +1 −1 tests/testcases/roundtrip/ast-literals-if-it-looks-like-a-block-1.boo
  20. +6 −20 tests/testcases/roundtrip/attributes-1.boo
  21. +1 −1 tests/testcases/roundtrip/callables-1.boo
  22. +3 −4 tests/testcases/roundtrip/callables-2.boo
  23. +2 −2 tests/testcases/roundtrip/callables-with-varags.boo
  24. +3 −10 tests/testcases/roundtrip/class-1.boo
  25. +0 −4 tests/testcases/roundtrip/class-2.boo
  26. +1 −2 tests/testcases/roundtrip/class-3.boo
  27. +5 −3 tests/testcases/roundtrip/closures-1.boo
  28. +1 −2 tests/testcases/roundtrip/closures-10.boo
  29. +2 −2 tests/testcases/roundtrip/closures-11.boo
  30. +3 −2 tests/testcases/roundtrip/closures-12.boo
  31. +2 −2 tests/testcases/roundtrip/closures-13.boo
  32. +1 −2 tests/testcases/roundtrip/closures-14.boo
  33. +5 −6 tests/testcases/roundtrip/closures-15.boo
View
4 tests/testcases/roundtrip/arrays-1.boo
@@ -1,8 +1,8 @@
"""
names = ('Tex', 'Nanico', 'Bamboo')
attributes = ('rules', 'sucks', 'is a big head')
-for n, a in zip(names, attributes):
- print("\$n \$a!")
+for ((n, a) in zip(names, attributes)):
+ print('\${n} \${a}!')
single_element_array = ('one and only',)
"""
names = (
View
8 tests/testcases/roundtrip/arrays-2.boo
@@ -1,8 +1,8 @@
"""
-names = ('Georges', 'Rodrigo', 'Wenderson')
-nicknames = ('gb', 'bamboo', 'jontex')
-for i in (1, 2, 3):
- print("\$(names[i]): \$(nicknames[i])")
+names = 'Georges', 'Rodrigo', 'Wenderson'
+nicknames = 'gb', 'bamboo', 'jontex'
+for (i in (1, 2, 3)):
+ print('\${names[i]}: \${nicknames[i]}')
"""
names = "Georges", "Rodrigo", "Wenderson"
View
7 tests/testcases/roundtrip/arrays-3.boo
@@ -1,8 +1,9 @@
"""
-a = (1, (b = 2), 3)
-lock spam = foo(), eggs = bar()
+a = (1, b = 2, 3)
+lock spam = foo(), eggs = bar():
+ pass
c = (1 in (1, 2, 3))
-print((d = 1), 2)
+print(d = 1, 2)
print((1 in (1, 2, 3)))
"""
a = (1, b=2, 3)
View
2 tests/testcases/roundtrip/arrays-5.boo
@@ -1,6 +1,6 @@
"""
a0 as (int)
-a1 as (int)
+a1 as (int, 1)
a2 as (int, 2)
"""
a0 as (int)
View
10 tests/testcases/roundtrip/as-1.boo
@@ -1,15 +1,15 @@
"""
l = List()
-if z = (l as object):
+if (z = (l as object)):
pass
-if not (z = (l as object)):
+if not ((z = (l as object))):
pass
q = (l as object)
-if q is (l as object):
+if (q is (l as object)):
pass
a = [1, 2]
-b as object = [3, 4]
-if a + (b as List):
+(b as object) = [3, 4]
+if (a + (b as List)):
pass
"""
l = List()
View
2 tests/testcases/roundtrip/assignment-1.boo
@@ -1,7 +1,7 @@
"""
a = (3 + 2)
a += (5 * 2)
-a /= (-1)
+a /= -1
a *= 2
a -= 3
View
1 tests/testcases/roundtrip/ast-literal-enum.boo
@@ -1,7 +1,6 @@
"""
e = [|
enum Foo:
-
Bar
|]
"""
View
19 tests/testcases/roundtrip/ast-literals-1.boo
@@ -1,42 +1,33 @@
"""
literal = [|
class Foo:
-
def bar():
print 'Hello'
|]
-
literal = [|
def main():
print('Hello, world!')
|]
-
literal = [|
- private foo as int
+ private (foo as int)
|]
-
literal = [|
- private foo = 0
+ private (foo = 0)
|]
-
literal = [|
- private foo as object = object()
+ private ((foo as object) = object())
|]
-
literal = [|
- event Foo as Bar
+ event (Foo as Bar)
|]
-
literal = [|
[once]
def bar():
return foo()
|]
-
literal = [|
protected Property:
- get:
- return null
+ get: return null
|]
"""
literal = [|
View
6 tests/testcases/roundtrip/ast-literals-10.boo
@@ -1,8 +1,8 @@
"""
return [|
- [Boo.Lang.ExtensionAttribute]
- [System.Runtime.CompilerServices.CompilerGeneratedAttribute]
- static def Foo(parent as \$(parent.FullName)) as \$(extension):
+ [((Boo . Lang) . ExtensionAttribute)]
+ [(((System . Runtime) . CompilerServices) . CompilerGeneratedAttribute)]
+ static def (Foo((parent as \$((parent . FullName)))) as \$(extension)):
return \$(ReferenceExpression(extension))(context)
|]
"""
View
15 tests/testcases/roundtrip/ast-literals-11.boo
@@ -1,26 +1,19 @@
"""
p1 = [|
Foo:
- get:
- return 'foo'
+ get: return 'foo'
|]
-
p2 = [|
Foo as string:
- get:
- return 'bar'
+ get: return 'bar'
|]
-
p3 = [|
Foo:
- set:
- _foo = value
+ set: _foo = value
|]
-
p4 = [|
Foo as string:
- set:
- _foo = value
+ set: _foo = value
|]
"""
p1 = [|
View
4 tests/testcases/roundtrip/ast-literals-2.boo
@@ -1,6 +1,6 @@
"""
-literal = [| print('Hello, world') |]
-literal = [| System.Console.WriteLine("\$message") |]
+literal = [|print('Hello, world')|]
+literal = [|((System . Console) . WriteLine('\${message}'))|]
"""
literal = [| print("Hello, world") |]
literal = [| System.Console.WriteLine("${message}") |]
View
6 tests/testcases/roundtrip/ast-literals-3.boo
@@ -1,7 +1,7 @@
"""
-print([| print('Hello, world') |])
-print [| System.Console.WriteLine("\$message") |]
-nodes = [[| foo |], [| bar |]]
+print([|print('Hello, world')|])
+print[|((System . Console) . WriteLine('\${message}'))|]
+nodes = [[|foo|], [|bar|]]
"""
print([| print("Hello, world") |])
print [| System.Console.WriteLine("${message}") |]
View
12 tests/testcases/roundtrip/ast-literals-4.boo
@@ -1,13 +1,7 @@
"""
-a = [|
- return 3
-|]
-
-d = [|
- print 'Hello, world'
-|]
-
-e = [| print('Hello, world') |]
+a = [|return 3|]
+d = [|print 'Hello, world'|]
+e = [|print('Hello, world')|]
"""
a = [| return 3 |]
d = [| print "Hello, world" |]
View
1 tests/testcases/roundtrip/ast-literals-5.boo
@@ -2,7 +2,6 @@
a = [|
return 42
|]
-
b = [|
while not foo:
print 'bar'
View
6 tests/testcases/roundtrip/ast-literals-6.boo
@@ -3,12 +3,8 @@ def foo():
return [|
return 3
|]
-
-
def bar():
- return [|
- print 'Hello, world'
- |]
+ return [|print 'Hello, world'|]
"""
def foo():
return [|
View
9 tests/testcases/roundtrip/ast-literals-7.boo
@@ -1,16 +1,9 @@
"""
class Foo:
-
node1 = [|
return 3
|]
-
-
- node2 = [|
- return 42
- |]
-
-
+ node2 = [|return 42|]
print 'it works'
"""
class Foo:
View
8 tests/testcases/roundtrip/ast-literals-8.boo
@@ -1,12 +1,8 @@
"""
-node1 as Node = [|
+(node1 as Node) = [|
return 3
|]
-
-node2 as Node = [|
- return 42
-|]
-
+(node2 as Node) = [|return 42|]
print 'it works'
"""
node1 as Node = [|
View
5 tests/testcases/roundtrip/ast-literals-9.boo
@@ -2,10 +2,9 @@
a = [|
print 'foo'
|]
-
b = [|
- System.Console.WriteLine('foo')
- System.Console.WriteLine('bar')
+ (System . Console) . WriteLine('foo')
+ (System . Console) . WriteLine('bar')
|]
"""
a = [|
View
2 tests/testcases/roundtrip/ast-literals-if-it-looks-like-a-block-1.boo
@@ -1,7 +1,7 @@
"""
code = [|
a = 0
- while a < 42:
+ while (a < 42):
print a
++a
|]
View
26 tests/testcases/roundtrip/attributes-1.boo
@@ -1,51 +1,37 @@
"""
[XmlElement('Person', Namespace: 'urn:foo:bar')]
class Person:
-
enum Status:
-
[description('Rich People')]
A
-
[description('SoSo People')]
B
-
[description('Poor People')]
C
-
[description('Les Miserable')]
D
-
[accessors(FirstName)]
_fname as string
-
[accessors(LastName)]
_lname as string
-
[accessors(DateOfBirth)]
_dof as date
-
[accessors(Status)]
_class as Status
-
- def constructor([required] fname as string, [required] lname as string):
+ def constructor([required] (fname as string), [required] (lname as string)):
_fname = fname
_lname = lname
-
[memoize]
- [before((null != _fname))]
- [before((null != _lname))]
- def GetName() [capitalize] as string:
- return "\$_fname \$_lname"
-
+ [before((null != _fname)), before((null != _lname))]
+ def GetName() ([capitalize] as string):
+ return '\${_fname} \${_lname}'
[XmlAttribute]
Age as int:
[memoize]
get:
- return (_dof - date.Now).TotalDays
-
+ return (((_dof - (date . Now))) . TotalDays)
[XmlIgnore]
- Property[[required] key as string]:
+ Property[[required] (key as string)]:
get:
return null
View
2 tests/testcases/roundtrip/callables-1.boo
@@ -2,7 +2,7 @@
callable CallableDef1()
callable CallableDef2(arg)
callable CallableDef3(arg1 as string, arg2 as bool)
-callable CallableDef4(arg) as bool
+callable (CallableDef4(arg) as bool)
"""
callable CallableDef1()
callable CallableDef2(arg)
View
7 tests/testcases/roundtrip/callables-2.boo
@@ -1,10 +1,9 @@
"""
def each(items, action as callable(object)):
- for item in items:
+ for (item in items):
action(item)
-
-def map(items, function as callable(object) as object):
- return (function(item) for item in items)
+def map(items, (function as callable(object)) as object):
+ return function(item) for (item in items)
"""
def each(items, action as callable(object)):
for item in items:
View
4 tests/testcases/roundtrip/callables-with-varags.boo
@@ -1,6 +1,6 @@
"""
-a as callable(*(string)) as string
-b as callable(int, *(string)) as string
+(a as callable(*(string))) as string
+(b as callable(int, *(string))) as string
"""
a as callable(*(string)) as string
b as callable(int, *(string)) as string
View
13 tests/testcases/roundtrip/class-1.boo
@@ -1,25 +1,18 @@
"""
class Person:
-
_id as string
-
_fname as string
-
def constructor(id as string, fname as string):
_id = id
_fname = fname
-
- def getID() as string:
+ def (getID() as string):
return _id
-
- def getFirstName() as string:
+ def (getFirstName() as string):
return _fname
-
def dump():
pass
-
p = Person('1111', 'Bamboo')
-p.dump()
+p . dump()
"""
class Person:
View
4 tests/testcases/roundtrip/class-2.boo
@@ -1,16 +1,12 @@
"""
interface IFoo:
pass
-
interface IBar(IFoo):
pass
-
class Person(IFoo):
pass
-
class Customer(Person, IBar, IFoo):
pass
-
"""
interface IFoo:
pass
View
3 tests/testcases/roundtrip/class-3.boo
@@ -1,8 +1,7 @@
"""
class C1:
pass
-
-class C2:
+class C2():
pass
"""
class C1:
View
8 tests/testcases/roundtrip/closures-1.boo
@@ -1,7 +1,9 @@
"""
-p = { text | print(text) }
-tp = { text as string | print(text) }
-if 2 > 3:
+p = def(text):
+ print(text)
+tp = def((text as string)):
+ print(text)
+if (2 > 3):
print('dough!')
p('Hello')
tp('World!')
View
3 tests/testcases/roundtrip/closures-10.boo
@@ -1,7 +1,6 @@
"""
class Foo:
-
- bar = { msg | print(msg) }
+ bar = {(msg | print(msg))}
"""
class Foo:
bar = { msg | print(msg) }
View
4 tests/testcases/roundtrip/closures-11.boo
@@ -1,7 +1,7 @@
"""
class Foo:
-
- bar = { msg | print(msg) }
+ bar = def(msg):
+ print(msg)
"""
class Foo:
bar = def (msg):
View
5 tests/testcases/roundtrip/closures-12.boo
@@ -1,6 +1,7 @@
"""
-a = [1, 2, 3].Find({ item as int | return (item > 2) })
-if a < 2:
+a = ([1, 2, 3] . Find()) do((item as int)):
+ return (item > 2)
+if (a < 2):
raise 'OUCH!'
"""
a = [1, 2, 3].Find() do (item as int):
View
4 tests/testcases/roundtrip/closures-13.boo
@@ -1,7 +1,7 @@
"""
def foo():
- return [1, 2, 3].Find({ item as int | return (item > 2) })
-
+ return ([1, 2, 3] . Find()) do((item as int)):
+ return (item > 2)
print(foo())
"""
def foo():
View
3 tests/testcases/roundtrip/closures-14.boo
@@ -1,7 +1,6 @@
"""
def foo():
- return { print('foo') }
-
+ return {print('foo')}
print(foo()())
"""
def foo():
View
11 tests/testcases/roundtrip/closures-15.boo
@@ -1,10 +1,9 @@
"""
-def abs(i as int):
- return { return i } if (i > 0)
- return { return (1 - i) }
-
-assert 3 == abs(-3)()
-assert 1 == abs(1)()
+def abs((i as int)):
+ return {return i} if (i > 0)
+ return {return (1 - i)}
+assert (3 == abs(-3)())
+assert (1 == abs(1)())
"""
def abs(i as int):
return { return i } if i > 0

0 comments on commit b152e54

Please sign in to comment.
Something went wrong with that request. Please try again.