   throws -> CoffeeScript.compile "fn(,0)"
   throws -> CoffeeScript.compile "fn(;0)"
 
-func = ->
-  return if true
-eq undefined, func()
-
-result = ("hello".slice) 3
-ok result is 'lo'
-
-# And even with strange things like this:
-funcs  = [((x) -> x), ((x) -> x * x)]
-result = funcs[1] 5
-ok result is 25
-
-# More fun with optional parens.
-fn = (arg) -> arg
-ok fn(fn {prop: 101}).prop is 101
-
-okFunc = (f) -> ok(f())
-okFunc -> true
+
+test "function invocation", ->
+
+  func = ->
+    return if true
+  eq undefined, func()
+
+  result = ("hello".slice) 3
+  ok result is 'lo'
+
+
+test "And even with strange things like this:", ->
+
+  funcs  = [((x) -> x), ((x) -> x * x)]
+  result = funcs[1] 5
+  ok result is 25
+
+
+test "More fun with optional parens.", ->
+
+  fn = (arg) -> arg
+  ok fn(fn {prop: 101}).prop is 101
+
+  okFunc = (f) -> ok(f())
+  okFunc -> true
+
 
 test "chained function calls", ->
   nonce = {}

  fn.withAt()
  fn.withThis()

# Trying an implicit object call with a trailing function.
a = null
meth = (arg, obj, func) -> a = [obj.a, arg, func()].join ' '
meth 'apple', b: 1, a: 13, ->
  'orange'
ok a is '13 apple orange'

# Ensure that empty functions don't return mistaken values.
obj =
  func: (@param, @rest...) ->
ok obj.func(101, 102, 103, 104) is undefined
ok obj.param is 101
ok obj.rest.join(' ') is '102 103 104'

# Passing multiple functions without paren-wrapping is legal, and should compile.
sum = (one, two) -> one() + two()
result = sum ->
  7 + 9
, ->
  1 + 3
ok result is 20

# Implicit call with a trailing if statement as a param.
func = -> arguments[1]
result = func 'one', if false then 100 else 13
ok result is 13

# Test more function passing:
result = sum( ->
  1 + 2
, ->
  2 + 1
)
ok result is 6

sum = (a, b) -> a + b
result = sum(1
, 2)
ok result is 3

# Chained blocks, with proper indentation levels:
counter =
  results: []
  tick: (func) ->
    @results.push func()
    this
counter
  .tick ->
    3
  .tick ->
    2
  .tick ->
    1
arrayEq [3,2,1], counter.results

# This is a crazy one.
x = (obj, func) -> func obj
ident = (x) -> x
result = x {one: ident 1}, (obj) ->
  inner = ident(obj)
  ident inner
ok result.one is 1

# More paren compilation tests:
reverse = (obj) -> obj.reverse()
ok reverse([1, 2].concat 3).join(' ') is '3 2 1'

# Test for inline functions with parentheses and implicit calls.
combine = (func, num) -> func() * num
result  = combine (-> 1 + 2), 3
ok result is 9

# Test for calls/parens/multiline-chains.
f = (x) -> x
result = (f 1).toString()
  .length
ok result is 1

# Test implicit calls in functions in parens:
result = ((val) ->
  [].push val
  val
)(10)
ok result is 10

# Ensure that chained calls with indented implicit object literals below are
# alright.
result = null
obj =
  method: (val)  -> this
  second: (hash) -> result = hash.three
obj
  .method(
    101
  ).second(
    one:
      two: 2
    three: 3
  )
eq result, 3

# Test newline-supressed call chains with nested functions.
obj  =
  call: -> this
func = ->
  obj
    .call ->
      one two
    .call ->
      three four
  101
eq func(), 101

# Implicit objects with number arguments.
func = (x, y) -> y
obj =
  prop: func "a", 1
ok obj.prop is 1

# Non-spaced unary and binary operators should cause a function call.
func = (val) -> val + 1
ok (func +5) is 6
ok (func -5) is -4

# Prefix unary assignment operators are allowed in parenless calls.
val = 5
ok (func --val) is 5

test "#855: execution context for `func arr...` should be `null`", ->
  contextTest = -> eq @, global

  eq a, (id a)
  eq c, (id a, b, c)[2]


test "passing arguments on separate lines", ->

  a = {}
  b = {}
  c = {}
