diff --git a/test/test_assignment.coffee b/test/test_assignment.coffee index ebe72da7..1a634a7f 100644 --- a/test/test_assignment.coffee +++ b/test/test_assignment.coffee @@ -1,5 +1,3 @@ -# Assign to try/catch. - result: try nonexistent * missing catch error @@ -7,17 +5,15 @@ catch error result2: try nonexistent * missing catch error then true -puts result is true and result2 is true +ok result is true and result2 is true, 'can assign the result of a try/catch block' -# Assign to conditional. - get_x: -> 10 if x: get_x() then 100 -puts x is 10 +ok x is 10, 'can assign a conditional statement' x: if get_x() then 100 -puts x is 100 \ No newline at end of file +ok x is 100, 'can assign a conditional statement' \ No newline at end of file diff --git a/test/test_blocks.coffee b/test/test_blocks.coffee index 98097dcc..67629dcf 100644 --- a/test/test_blocks.coffee +++ b/test/test_blocks.coffee @@ -1,4 +1,4 @@ results: [1, 2, 3].map (x) -> x * x -puts results.join(' ') is '1 4 9' \ No newline at end of file +ok results.join(' ') is '1 4 9', 'basic block syntax' \ No newline at end of file diff --git a/test/test_calling_super.coffee b/test/test_calling_super.coffee index 7e4ab2d8..6494a958 100644 --- a/test/test_calling_super.coffee +++ b/test/test_calling_super.coffee @@ -21,7 +21,7 @@ ThirdChild::func: (string) -> result: (new ThirdChild()).func 'four' -puts result is 'zero/one/two/three/four' +ok result is 'zero/one/two/three/four', 'successfully set up and called a four-level inheritance chain' TopClass: (arg) -> @@ -39,4 +39,4 @@ SubClass: -> SuperClass extends TopClass SubClass extends SuperClass -puts((new SubClass()).prop is 'top-super-sub') \ No newline at end of file +ok (new SubClass()).prop is 'top-super-sub', 'inheritance' \ No newline at end of file diff --git a/test/test_chained_calls.coffee b/test/test_chained_calls.coffee index eaad589a..75a10f3d 100644 --- a/test/test_chained_calls.coffee +++ b/test/test_chained_calls.coffee @@ -3,7 +3,7 @@ identity_wrap: (x) -> result: identity_wrap(identity_wrap(true))()() -puts result +ok result, 'basic chained function calls' str: 'god' @@ -14,7 +14,7 @@ result: str. reverse(). reverse() -puts result.join('') is 'dog' +ok result.join('') is 'dog', 'chained accesses split on period/newline' result: str .split('') @@ -22,4 +22,4 @@ result: str .reverse() .reverse() -puts result.join('') is 'dog' \ No newline at end of file +ok result.join('') is 'dog', 'chained accesses split on newline/period' \ No newline at end of file diff --git a/test/test_destructuring_assignment.coffee b/test/test_destructuring_assignment.coffee index da5ab0fc..0fafeba5 100644 --- a/test/test_destructuring_assignment.coffee +++ b/test/test_destructuring_assignment.coffee @@ -3,26 +3,26 @@ b: -2 [a, b]: [b, a] -puts a is -2 -puts b is -1 +ok a is -2 +ok b is -1 arr: [1, 2, 3] [a, b, c]: arr -puts a is 1 -puts b is 2 -puts c is 3 +ok a is 1 +ok b is 2 +ok c is 3 obj: {x: 10, y: 20, z: 30} {x: a, y: b, z: c}: obj -puts a is 10 -puts b is 20 -puts c is 30 +ok a is 10 +ok b is 20 +ok c is 30 person: { @@ -42,8 +42,8 @@ person: { {name: a, family: {brother: {addresses: [one, {city: b}]}}}: person -puts a is "Bob" -puts b is "Moquasset NY, 10021" +ok a is "Bob" +ok b is "Moquasset NY, 10021" test: { @@ -59,4 +59,4 @@ test: { {person: {address: [ignore, addr...]}}: test -puts addr.join(', ') is "Street 101, Apt 101, City 101" \ No newline at end of file +ok addr.join(', ') is "Street 101, Apt 101, City 101" \ No newline at end of file diff --git a/test/test_everything.coffee b/test/test_everything.coffee index c52ae0a1..a08c8a85 100644 --- a/test/test_everything.coffee +++ b/test/test_everything.coffee @@ -26,4 +26,4 @@ func: -> c.single: c.list[1..1][0] -puts func() is '-' +ok func() is '-' diff --git a/test/test_existence.coffee b/test/test_existence.coffee index a87693af..c08d8151 100644 --- a/test/test_existence.coffee +++ b/test/test_existence.coffee @@ -1,8 +1,8 @@ -puts(if my_special_variable? then false else true) +ok(if my_special_variable? then false else true) my_special_variable: false -puts(if my_special_variable? then true else false) +ok(if my_special_variable? then true else false) # Existential assignment. @@ -12,7 +12,7 @@ a: null a ?= 10 b ?= 10 -puts a is 10 and b is 10 +ok a is 10 and b is 10 # The existential operator. @@ -20,7 +20,7 @@ puts a is 10 and b is 10 z: null x: z ? "EX" -puts z is null and x is "EX" +ok z is null and x is "EX" # Only evaluate once. @@ -30,7 +30,7 @@ get_next_node: -> throw "up" if counter counter++ -puts(if get_next_node()? then true else false) +ok(if get_next_node()? then true else false) # Existence chains, soaking up undefined properties: @@ -39,19 +39,19 @@ obj: { prop: "hello" } -puts obj?.prop is "hello" +ok obj?.prop is "hello" -puts obj.prop?.length is 5 +ok obj.prop?.length is 5 -puts obj?.prop?.non?.existent?.property is undefined +ok obj?.prop?.non?.existent?.property is undefined # Soaks and caches method calls as well. arr: ["--", "----"] -puts arr.pop()?.length is 4 -puts arr.pop()?.length is 2 -puts arr.pop()?.length is undefined -puts arr[0]?.length is undefined -puts arr.pop()?.length?.non?.existent()?.property is undefined +ok arr.pop()?.length is 4 +ok arr.pop()?.length is 2 +ok arr.pop()?.length is undefined +ok arr[0]?.length is undefined +ok arr.pop()?.length?.non?.existent()?.property is undefined diff --git a/test/test_expressions.coffee b/test/test_expressions.coffee index eee44179..891aa5f2 100644 --- a/test/test_expressions.coffee +++ b/test/test_expressions.coffee @@ -9,7 +9,7 @@ findit: (items) -> for item in items return item if item is "bacon" -puts findit(items) is "bacon" +ok findit(items) is "bacon" # When when a closure wrapper is generated for expression conversion, make sure @@ -26,5 +26,5 @@ obj: { this.num } -puts obj.num is obj.func() -puts obj.num is obj.result \ No newline at end of file +ok obj.num is obj.func() +ok obj.num is obj.result \ No newline at end of file diff --git a/test/test_fancy_if_statement.coffee b/test/test_fancy_if_statement.coffee index 711c9362..f4359a3e 100644 --- a/test/test_fancy_if_statement.coffee +++ b/test/test_fancy_if_statement.coffee @@ -7,13 +7,13 @@ result: if a if d true -puts result +ok result first: if false then false else second: if false then false else true -puts first -puts second +ok first +ok second result: if false @@ -23,4 +23,4 @@ else if NaN else true -puts result \ No newline at end of file +ok result \ No newline at end of file diff --git a/test/test_functions.coffee b/test/test_functions.coffee index cd0d8a7e..512c6dc2 100644 --- a/test/test_functions.coffee +++ b/test/test_functions.coffee @@ -2,11 +2,11 @@ x: 1 y: {} y.x: -> 3 -puts x is 1 -puts typeof(y.x) is 'function' -puts y.x instanceof Function -puts y.x() is 3 -puts y.x.name is 'x' +ok x is 1 +ok typeof(y.x) is 'function' +ok y.x instanceof Function +ok y.x() is 3 +ok y.x.name is 'x' # The empty function should not cause a syntax error. @@ -18,10 +18,10 @@ obj: { name: "Fred" bound: -> - (=> puts(this.name is "Fred"))() + (=> ok(this.name is "Fred"))() unbound: -> - (-> puts(!this.name?))() + (-> ok(!this.name?))() } obj.unbound() @@ -45,18 +45,18 @@ Math: { FastAdd: memoize (a, b) -> a + b } -puts Math.Add(5, 5) is 10 -puts Math.AnonymousAdd(10, 10) is 20 -puts Math.FastAdd(20, 20) is 40 +ok Math.Add(5, 5) is 10 +ok Math.AnonymousAdd(10, 10) is 20 +ok Math.FastAdd(20, 20) is 40 # Parens are optional on simple function calls. -puts 100 > 1 if 1 > 0 -puts true unless false -puts true for i in [1..3] +ok 100 > 1 if 1 > 0 +ok true unless false +ok true for i in [1..3] -puts_func: (f) -> puts(f()) -puts_func -> true +ok_func: (f) -> ok(f()) +ok_func -> true # Optional parens can be used in a nested fashion. call: (func) -> func() @@ -65,7 +65,7 @@ result: call -> inner: call -> Math.Add(5, 5) -puts result is 10 +ok result is 10 # And even with strange things like this: @@ -73,8 +73,8 @@ puts result is 10 funcs: [(x) -> x, (x) -> x * x] result: funcs[1] 5 -puts result is 25 +ok result is 25 result: ("hello".slice) 3 -puts result is 'lo' \ No newline at end of file +ok result is 'lo' \ No newline at end of file diff --git a/test/test_funky_comments.coffee b/test/test_funky_comments.coffee index 3067b210..a851325e 100644 --- a/test/test_funky_comments.coffee +++ b/test/test_funky_comments.coffee @@ -18,7 +18,7 @@ switch 'string' code() # comment -puts func() +ok func() func func diff --git a/test/test_heredocs.coffee b/test/test_heredocs.coffee index 5304fb26..d9f8e8f0 100644 --- a/test/test_heredocs.coffee +++ b/test/test_heredocs.coffee @@ -3,7 +3,7 @@ a: """ on two lines """ -puts a is "basic heredoc\non two lines" +ok a is "basic heredoc\non two lines" a: ''' @@ -12,12 +12,12 @@ a: ''' c ''' -puts a is "a\n \"b\nc" +ok a is "a\n \"b\nc" a: '''one-liner''' -puts a is 'one-liner' +ok a is 'one-liner' a: """ @@ -25,7 +25,7 @@ a: """ here """ -puts a is "out\nhere" +ok a is "out\nhere" a: ''' @@ -34,7 +34,7 @@ a: ''' c ''' -puts a is " a\n b\nc" +ok a is " a\n b\nc" a: ''' a @@ -43,4 +43,4 @@ a b c ''' -puts a is "a\n\n\nb c" +ok a is "a\n\n\nb c" diff --git a/test/test_lexical_scope.coffee b/test/test_lexical_scope.coffee index 5693ecd6..22951265 100644 --- a/test/test_lexical_scope.coffee +++ b/test/test_lexical_scope.coffee @@ -1,10 +1,10 @@ num: 1 + 2 + (a: 3) -puts num is 6 +ok num is 6 result: if true false other: "result" -puts result is "result" and other is "result" \ No newline at end of file +ok result is "result" and other is "result" \ No newline at end of file diff --git a/test/test_literals.coffee b/test/test_literals.coffee index f1128a7f..e07bfcec 100644 --- a/test/test_literals.coffee +++ b/test/test_literals.coffee @@ -1,43 +1,43 @@ a: [(x) -> x, (x) -> x * x] -puts a.length is 2 +ok a.length is 2 regex: /match/i words: "I think there is a match in here." -puts !!words.match(regex) +ok !!words.match(regex) neg: (3 -4) -puts neg is -1 +ok neg is -1 func: -> return if true -puts func() is null +ok func() is null str: "\\" reg: /\\/ -puts reg(str) and str is '\\' +ok reg(str) and str is '\\' i: 10 while i -= 1 -puts i is 0 +ok i is 0 money$: 'dollars' -puts money$ is 'dollars' +ok money$ is 'dollars' -puts {a: (num) -> num is 10 }.a 10 +ok {a: (num) -> num is 10 }.a 10 bob: { @@ -49,8 +49,8 @@ bob: { 10: 'number' } -puts bob.hello() is "Hello Bob" -puts bob[10] is 'number' +ok bob.hello() is "Hello Bob" +ok bob[10] is 'number' obj: { @@ -58,5 +58,5 @@ obj: { 'not': -> no } -puts obj.is() -puts not obj.not() +ok obj.is() +ok not obj.not() diff --git a/test/test_nested_comprehensions.coffee b/test/test_nested_comprehensions.coffee index 77ed44b6..66d14128 100644 --- a/test/test_nested_comprehensions.coffee +++ b/test/test_nested_comprehensions.coffee @@ -6,6 +6,6 @@ multi_liner: single_liner: [x, y] for y in [3..5] for x in [3..5] -puts multi_liner.length is single_liner.length -puts 5 is multi_liner[2][2][1] -puts 5 is single_liner[2][2][1] +ok multi_liner.length is single_liner.length +ok 5 is multi_liner[2][2][1] +ok 5 is single_liner[2][2][1] diff --git a/test/test_newline_escaping.coffee b/test/test_newline_escaping.coffee index d5c30899..dc22f610 100644 --- a/test/test_newline_escaping.coffee +++ b/test/test_newline_escaping.coffee @@ -3,4 +3,4 @@ six: 2 + 3 -puts six is 6 \ No newline at end of file +ok six is 6 \ No newline at end of file diff --git a/test/test_operations.coffee b/test/test_operations.coffee index 86699ca2..75ebd9c0 100644 --- a/test/test_operations.coffee +++ b/test/test_operations.coffee @@ -1,12 +1,12 @@ # CoffeeScript's operations should be chainable, like Python's. -puts 500 > 50 > 5 > -5 +ok 500 > 50 > 5 > -5 -puts true is not false is true is not false +ok true is not false is true is not false -puts 10 < 20 > 10 +ok 10 < 20 > 10 -puts 50 > 10 > 5 is parseInt('5', 10) +ok 50 > 10 > 5 is parseInt('5', 10) # Make sure that each argument is only evaluated once, even if used @@ -15,4 +15,4 @@ puts 50 > 10 > 5 is parseInt('5', 10) i: 0 func: -> i++ -puts 1 > func() < 1 +ok 1 > func() < 1 diff --git a/test/test_range_comprehension.coffee b/test/test_range_comprehension.coffee index 67d41e19..bf383cf2 100644 --- a/test/test_range_comprehension.coffee +++ b/test/test_range_comprehension.coffee @@ -5,16 +5,16 @@ negs: negs[0..2] result: nums.concat(negs).join(', ') -puts result is '3, 6, 9, -20, -19, -18' +ok result is '3, 6, 9, -20, -19, -18' # Ensure that ranges are safe. This used to infinite loop: j = 5 result: for j in [j..(j+3)] j -puts result.join(' ') is '5 6 7 8' +ok result.join(' ') is '5 6 7 8' # With range comprehensions, you can loop in steps. results: x for x in [0..25] by 5 -puts results.join(' ') is '0 5 10 15 20 25' \ No newline at end of file +ok results.join(' ') is '0 5 10 15 20 25' \ No newline at end of file diff --git a/test/test_ranges_and_slices.coffee b/test/test_ranges_and_slices.coffee index 3a174555..3c2abe26 100644 --- a/test/test_ranges_and_slices.coffee +++ b/test/test_ranges_and_slices.coffee @@ -5,12 +5,12 @@ b: array[2...4] result: a.concat(b).join(' ') -puts result is "7 8 9 2 3" +ok result is "7 8 9 2 3" countdown: [10..1].join(' ') -puts countdown is "10 9 8 7 6 5 4 3 2 1" +ok countdown is "10 9 8 7 6 5 4 3 2 1" array: [(1+5)..1+9] -puts array.join(' ') is "6 7 8 9 10" \ No newline at end of file +ok array.join(' ') is "6 7 8 9 10" \ No newline at end of file diff --git a/test/test_splats.coffee b/test/test_splats.coffee index b50c2fb2..7270103c 100644 --- a/test/test_splats.coffee +++ b/test/test_splats.coffee @@ -3,7 +3,7 @@ func: (first, second, rest...) -> result: func 1, 2, 3, 4, 5 -puts result is "3 4 5" +ok result is "3 4 5" gold: silver: bronze: the_field: null @@ -29,7 +29,7 @@ contenders: [ medalists "Mighty Mouse", contenders... -puts gold is "Mighty Mouse" -puts silver is "Michael Phelps" -puts bronze is "Liu Xiang" -puts the_field.length is 8 \ No newline at end of file +ok gold is "Mighty Mouse" +ok silver is "Michael Phelps" +ok bronze is "Liu Xiang" +ok the_field.length is 8 \ No newline at end of file diff --git a/test/test_splices.coffee b/test/test_splices.coffee index 56e6787d..0538dce4 100644 --- a/test/test_splices.coffee +++ b/test/test_splices.coffee @@ -2,4 +2,4 @@ array: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] array[5..10]: [0, 0, 0] -puts array.join(' ') is '0 1 2 3 4 0 0 0' \ No newline at end of file +ok array.join(' ') is '0 1 2 3 4 0 0 0' \ No newline at end of file diff --git a/test/test_switch.coffee b/test/test_switch.coffee index 7c6dda51..705a0cc4 100644 --- a/test/test_switch.coffee +++ b/test/test_switch.coffee @@ -14,7 +14,7 @@ result: switch num when 11 then false else false -puts result +ok result func: (num) -> @@ -25,7 +25,7 @@ func: (num) -> false else false -puts func(2) -puts func(6) -puts !func(3) -puts !func(8) +ok func(2) +ok func(6) +ok !func(3) +ok !func(8) diff --git a/test/test_while.coffee b/test/test_while.coffee index 0711e1ae..5eb372ce 100644 --- a/test/test_while.coffee +++ b/test/test_while.coffee @@ -1,28 +1,28 @@ i: 100 while i -= 1 -puts i is 0 +ok i is 0 i: 5 list: while i -= 1 i * 2 -puts list.join(' ') is "8 6 4 2" +ok list.join(' ') is "8 6 4 2" i: 5 list: (i * 3 while i -= 1) -puts list.join(' ') is "12 9 6 3" +ok list.join(' ') is "12 9 6 3" i: 5 func: (num) -> i -= num -assert: -> puts i < 5 > 0 +assert: -> ok i < 5 > 0 results: while func 1 assert() i -puts results.join(' ') is '4 3 2 1' \ No newline at end of file +ok results.join(' ') is '4 3 2 1' \ No newline at end of file