jashkenas--coffeescript/test/test_comments.coffee

130 lines
1.1 KiB
CoffeeScript
Raw Normal View History

2010-01-06 04:15:32 +00:00
# comment
func: ->
2010-01-06 04:15:32 +00:00
# comment
false
false # comment
false
# comment
true
2010-01-06 04:15:32 +00:00
2010-01-10 22:36:06 +00:00
switch 'string'
# comment
when false then something()
# comment
when null
somethingElse()
2010-01-10 22:36:06 +00:00
->
code()
# comment
ok func()
func
func
# Line3
obj: {
# comment
# comment
# comment
one: 1
# comment
two: 2
# comment
}
result: if true # comment
false
ok not result
result: if false
false
else # comment
45
ok result is 45
test:
'test ' +
'test ' + # comment
'test'
ok test is 'test test test'
###
This is a here-comment.
Kind of like a heredoc.
###
func: ->
###
Another block comment.
###
code
func: ->
one: ->
two: ->
three: ->
###
block.
###
four: ->
fn1: ->
oneLevel: null
###
This isn't fine.
###
ok ok
obj: {
a: 'b'
###
comment
###
c: 'd'
}
arr: [
1, 2, 3,
###
four
###
5, 6, 7
]
# Spaced comments in if / elses.
result: if false
1
# comment
else if false
2
# comment
else
3
ok result is 3
result: switch 'z'
when 'z' then 7
# comment
ok result is 7
# Trailing-line comment before an outdent.
func: ->
if true
true # comment
7
ok func() is 7