mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-04-11 03:00:13 -04:00
adding bound functions, with test
This commit is contained in:
22
test/fixtures/execution/test_functions.coffee
vendored
Normal file
22
test/fixtures/execution/test_functions.coffee
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
x: 1
|
||||
y: {}
|
||||
y.x: => 3
|
||||
|
||||
print(x is 1)
|
||||
print(typeof(y.x) is 'function')
|
||||
print(y.x() is 3)
|
||||
print(y.x.name is 'x')
|
||||
|
||||
|
||||
obj: {
|
||||
name: "Fred"
|
||||
|
||||
bound: =>
|
||||
(==> print(this.name is "Fred"))()
|
||||
|
||||
unbound: =>
|
||||
(=> print(!this.name?))()
|
||||
}
|
||||
|
||||
obj.unbound()
|
||||
obj.bound()
|
||||
Reference in New Issue
Block a user