1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
jashkenas--coffeescript/test/test_chaining.coffee
2010-04-19 23:18:39 -04:00

47 lines
646 B
CoffeeScript

# 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
ok six is 6
# Ensure that indented array literals don't trigger whitespace rewriting.
func: () ->
ok arguments.length is 1
func(
[[[[[],
[]],
[[]]]],
[]])