mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-16 18:44:56 -05:00
tests are now passing on symbology
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
hello: 'Hello'
|
||||
world: 'World'
|
||||
hello = 'Hello'
|
||||
world = 'World'
|
||||
ok '$hello $world!' is '$hello $world!'
|
||||
ok '${hello} ${world}!' is '${hello} ${world}!'
|
||||
ok "$hello $world!" is 'Hello World!'
|
||||
@@ -12,7 +12,7 @@ ok "Hello ${ 1 + 2 } World" is 'Hello 3 World'
|
||||
ok "$hello ${ 1 + 2 } $world" is "Hello 3 World"
|
||||
|
||||
|
||||
[s, t, r, i, n, g]: ['s', 't', 'r', 'i', 'n', 'g']
|
||||
[s, t, r, i, n, g] = ['s', 't', 'r', 'i', 'n', 'g']
|
||||
ok "$s$t$r$i$n$g" is 'string'
|
||||
ok "${s}${t}${r}${i}${n}${g}" is 'string'
|
||||
ok "\$s\$t\$r\$i\$n\$g" is '$s$t$r$i$n$g'
|
||||
@@ -47,12 +47,12 @@ ok "${hello + world}" is 'HelloWorld'
|
||||
ok "${hello + ' ' + world + '!'}" is 'Hello World!'
|
||||
|
||||
|
||||
list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
ok "values: ${list.join(', ')}, length: ${list.length}." is 'values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, length: 10.'
|
||||
ok "values: ${list.join ' '}" is 'values: 0 1 2 3 4 5 6 7 8 9'
|
||||
|
||||
|
||||
obj: {
|
||||
obj = {
|
||||
name: 'Joe'
|
||||
hi: -> "Hello $@name."
|
||||
cya: -> "Hello $@name.".replace('Hello','Goodbye')
|
||||
@@ -73,23 +73,23 @@ ok "Hello ${world ? "$hello"}" is 'Hello World'
|
||||
ok "Hello ${"${"${obj["name"]}" + '!'}"}" is 'Hello Joe!'
|
||||
|
||||
|
||||
a: """
|
||||
Hello ${ "Joe" }
|
||||
"""
|
||||
a = """
|
||||
Hello ${ "Joe" }
|
||||
"""
|
||||
ok a is "Hello Joe"
|
||||
|
||||
|
||||
a: 1
|
||||
b: 2
|
||||
c: 3
|
||||
a = 1
|
||||
b = 2
|
||||
c = 3
|
||||
ok "$a$b$c" is '123'
|
||||
|
||||
|
||||
result: null
|
||||
stash: (str) -> result: str
|
||||
result = null
|
||||
stash = (str) -> result = str
|
||||
stash "a ${ ('aa').replace /a/g, 'b' } c"
|
||||
ok result is 'a bb c'
|
||||
|
||||
|
||||
foo: "hello"
|
||||
foo = "hello"
|
||||
ok "${foo.replace("\"", "")}" is 'hello'
|
||||
Reference in New Issue
Block a user