Browse Source

Add test for passing a "this" to the sync. function and extracting the callback.

Edward Lee 15 years ago
parent
commit
753f023e3a
1 changed files with 9 additions and 0 deletions
  1. 9 0
      test/unit/test_Sync.js

+ 9 - 0
test/unit/test_Sync.js

@@ -69,6 +69,15 @@ function test_Sync_withCb() {
   }, 100);
 }
 
+// Extract sync. function callback that uses "this"
+function test_Sync_withCb_this() {
+  let [get, cb] = Sync.withCb(slowThisGet, { foo: "bar"});
+  checkTime(function() {
+    let val = get(cb, 100, "foo");
+    do_check_eq(val, "bar");
+  }, 100);
+}
+
 // Test sync of async function that indirectly takes the callback
 function test_Sync_withCb_indirect() {
   let [square, cb] = Sync.withCb(function(obj) {