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_splats.coffee

47 lines
779 B
CoffeeScript
Raw Normal View History

func: (first, second, rest...) ->
rest.join ' '
2009-12-31 17:50:12 -05:00
result: func 1, 2, 3, 4, 5
2009-12-31 17:50:12 -05:00
ok result is "3 4 5"
gold: silver: bronze: the_field: null
medalists: (first, second, third, rest...) ->
gold: first
silver: second
bronze: third
the_field: rest
contenders: [
"Michael Phelps"
"Liu Xiang"
"Yao Ming"
"Allyson Felix"
"Shawn Johnson"
"Roman Sebrle"
"Guo Jingjing"
"Tyson Gay"
"Asafa Powell"
"Usain Bolt"
]
medalists "Mighty Mouse", contenders...
ok gold is "Mighty Mouse"
ok silver is "Michael Phelps"
ok bronze is "Liu Xiang"
ok the_field.length is 8
obj: {
name: 'bob'
accessor: (args...) ->
[@name].concat(args).join(' ')
getNames: ->
args: ['jane', 'ted']
@accessor(args...)
}
ok obj.getNames() is 'bob jane ted'