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

159 lines
1.4 KiB
CoffeeScript
Raw Normal View History

# comment before a ...
###
... block comment.
###
2010-01-05 23:15:32 -05:00
# comment
2010-07-25 01:23:37 -04:00
func = ->
2010-01-05 23:15:32 -05:00
# comment
false
false # comment
false
# comment
true
2010-01-05 23:15:32 -05:00
2010-01-10 17:36:06 -05:00
switch 'string'
# comment
when false then something()
# comment
when null
somethingElse()
2010-01-10 17:36:06 -05:00
->
code()
# comment
ok func()
func
func
# Line3
2010-07-25 01:23:37 -04:00
obj = {
# comment
# comment
# comment
one: 1
# comment
two: 2
# comment
}
2010-07-25 01:23:37 -04:00
result = if true # comment
false
ok not result
2010-07-25 01:23:37 -04:00
result = if false
false
else # comment
45
ok result is 45
2010-07-25 01:23:37 -04:00
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
2010-07-25 01:23:37 -04:00
func = ->
one = ->
two = ->
three = ->
###
block.
###
2010-07-25 01:23:37 -04:00
four = ->
2010-07-25 01:23:37 -04:00
fn1 = ->
oneLevel = null
###
This isn't fine.
###
ok ok
2010-07-25 01:23:37 -04:00
obj = {
a: 'b'
###
comment
###
c: 'd'
}
# Spaced comments in if / elses.
2010-07-25 01:23:37 -04:00
result = if false
1
# comment
else if false
2
# comment
else
3
ok result is 3
2010-07-25 01:23:37 -04:00
result = switch 'z'
when 'z' then 7
# comment
ok result is 7
# Trailing-line comment before an outdent.
2010-07-25 01:23:37 -04:00
func = ->
if true
true # comment
7
ok func() is 7
# Trailing herecomment in a function.
2010-07-25 01:23:37 -04:00
fn = ->
code
###
debug code commented
###
2010-07-25 01:23:37 -04:00
fn2 = ->
class A
b: ->
###
Comment
###
c: ->
ok A.prototype.c instanceof Function
class A
###
Comment
###
b: ->
c: ->
ok A.prototype.b instanceof Function