2010-04-03 14:39:32 +00:00
|
|
|
# Basic chained function calls.
|
|
|
|
identity_wrap: (x) ->
|
|
|
|
-> x
|
|
|
|
|
|
|
|
result: identity_wrap(identity_wrap(true))()()
|
|
|
|
|
|
|
|
ok result
|
|
|
|
|
|
|
|
|
|
|
|
# Chained accesses split on period/newline, backwards and forwards.
|
|
|
|
str: 'god'
|
|
|
|
|
|
|
|
result: str.
|
|
|
|
split('').
|
|
|
|
reverse().
|
|
|
|
reverse().
|
|
|
|
reverse()
|
|
|
|
|
|
|
|
ok result.join('') is 'dog'
|
|
|
|
|
|
|
|
result: str
|
|
|
|
.split('')
|
|
|
|
.reverse()
|
|
|
|
.reverse()
|
|
|
|
.reverse()
|
|
|
|
|
|
|
|
ok result.join('') is 'dog'
|
|
|
|
|
|
|
|
|
|
|
|
# Newline suppression for operators.
|
|
|
|
six:
|
|
|
|
1 +
|
|
|
|
2 +
|
|
|
|
3
|
|
|
|
|
2010-04-18 04:41:47 +00:00
|
|
|
ok six is 6
|
|
|
|
|
2010-04-20 03:18:39 +00:00
|
|
|
|
|
|
|
# Ensure that indented array literals don't trigger whitespace rewriting.
|
2010-04-18 04:41:47 +00:00
|
|
|
func: () ->
|
|
|
|
ok arguments.length is 1
|
|
|
|
|
|
|
|
func(
|
2010-04-20 03:18:39 +00:00
|
|
|
[[[[[],
|
2010-04-18 04:41:47 +00:00
|
|
|
[]],
|
|
|
|
[[]]]],
|
|
|
|
[]])
|