Permalink
Browse files

add more tests to make sure that scoping is working.

  • Loading branch information...
1 parent e90ffb3 commit f4e14c051377c98c4c01c44606a8684c6f94547d @maxtaco committed Dec 14, 2011
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/tame.coffee
View
@@ -210,3 +210,21 @@ atest "loops respect autocbs", (cb) ->
ok = true
await bar defer()
cb(ok, {})
+
+atest "test scoping", (cb) ->
+ class MyClass
+ constructor : -> @val = 0
+ run : (autocb) ->
+ @val++
+ await delay defer()
+ @val++
+ ( -> val = 0 )()
+ @val++
+ await delay defer()
+ @val++
+ ( -> val = 0 )()
+ ++@val
+ getVal : -> @val
+ o = new MyClass
+ await o.run defer(v)
+ cb(v == 5, {})

0 comments on commit f4e14c0

Please sign in to comment.