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

63 lines
621 B
CoffeeScript
Raw Normal View History

a: [(x) -> x, (x) -> x * x]
ok a.length is 2
regex: /match/i
words: "I think there is a match in here."
ok !!words.match(regex)
2010-01-01 10:17:33 -05:00
neg: (3 -4)
ok neg is -1
func: ->
return if true
ok func() is null
str: "\\"
reg: /\\/
ok reg(str) and str is '\\'
i: 10
while i -= 1
ok i is 0
money$: 'dollars'
ok money$ is 'dollars'
2010-02-02 20:36:46 -05:00
ok {a: (num) -> num is 10 }.a 10
2010-02-02 20:36:46 -05:00
bob: {
name: 'Bob'
greet: (salutation) ->
salutation + " " + @name
hello: ->
2010-02-02 20:44:10 -05:00
@greet "Hello"
10: 'number'
2010-02-02 20:36:46 -05:00
}
ok bob.hello() is "Hello Bob"
ok bob[10] is 'number'
obj: {
'is': -> yes
'not': -> no
}
ok obj.is()
ok not obj.not()