1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
This commit is contained in:
Jeremy Ashkenas 2010-07-31 07:44:49 -04:00
parent d4ac11cd4f
commit 3301738b84

View file

@ -151,4 +151,35 @@ obj =
null
ok obj.options.value is yes
ok obj.fn() is null
ok obj.fn() is null
# Implicit objects with wacky indentation:
obj =
reverse: (obj) ->
Array.prototype.reverse.call obj
abc: ->
@reverse(
@reverse @reverse ['a', 'b', 'c'].reverse()
)
one: [1, 2,
a: 'b'
3, 4]
red:
orange:
yellow:
green: 'blue'
indigo: 'violet'
misdent: [[],
[],
[],
[]]
ok obj.abc().join(' ') is 'a b c'
ok obj.one.length is 5
ok obj.one[4] is 4
ok obj.one[2].a is 'b'
ok (key for key of obj.red).length is 2
ok obj.red.orange.yellow.green is 'blue'
ok obj.red.indigo is 'violet'
ok obj.misdent.toString() is ',,,'