text: /*** Generated by streamline fibers 0.2.2 - DO NOT EDIT ***/var fstreamline__ = require("streamline/lib/fibers/runtime"); (fstreamline__.create(function(_) {var failAsync_ = fstreamline__.create(failAsync), failSync_ = fstreamline__.create(failSync), A_ = fstreamline__.create(A), B_ = fstreamline__.create(B), C_ = fstreamline__.create(C), D_ = fstreamline__.create(D), E_ = fstreamline__.create(E), F_ = fstreamline__.create(F), G_ = fstreamline__.create(G), H_ = fstreamline__.create(H), I_ = fstreamline__.create(I), T_ = fstreamline__.create(T); //streamline.options = { "lines" : "preserve" }
  // WARNING: DO NOT INSERT COMMENTS OR ANYTHING
  // Line numbers matter to this test!
  
  var module = QUnit.module;
  var flows = require("streamline/lib/util/flows");
  
  function nextTick(cb){
  	setTimeout(function(){
  		cb();
  	}, 0);
  }
  
  function failAsync(_, code){
  	throw new Error(code);
  }
  
  function failSync(_, code){
  	(function fail(dummy){ // dummy to defeat CoffeeScript compat rule
  		throw new Error(code);
  	})(0);
  }
  
  var fail;
  
  function A(_, code){
  	if (code == 1) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	if (code == 2) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	fstreamline__.invoke(null, nextTick, [_], 0);
  	if (code == 3) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	for (var i = 0; i < 6; i++) {
  		if (code == i) 
  			fstreamline__.invoke(null, fail, [_, code], 0);
  		fstreamline__.invoke(null, nextTick, [_], 0);
  	}
  	if (code == 6) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	fstreamline__.invoke(null, nextTick, [_], 0);
  	B(_, code);
  	fstreamline__.invoke(null, nextTick, [_], 0);
  	return "END";
  }
  
  function B(_, code){
  	if (code == 7) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	C(_, code);
  	fstreamline__.invoke(null, nextTick, [_], 0);
  	C(_, code);
  	D(_, code);
  }
  
  function C(_, code){
  	if (code == 8) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  }
  
  function D(_, code){
  	if (code == 9) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  }
  
  function E(_, code){
  	try {
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	} 
  	catch (ex) {
  		if (code % 3 == 1) 
  			fstreamline__.invoke(null, fail, [_, code], 0);
  		else if (code % 3 == 2) 
  			A(_, code);
  		else 
  			return "OK " + code;
  	}
  }
  
  function F(_, code){
  	var f1 = A_(null, code);
  	var f2 = A_(null, code + 1);
  	return fstreamline__.invoke(null, f1, [_], 0) + " & " + fstreamline__.invoke(null, f2, [_], 0);
  }
  
  function G(_, code){
  	if (code == 5) 
  		fstreamline__.invoke(null, fail, [_, code], 0);
  	return "" + code;
  }
  
  function H(_, code){
  	if (code % 2 == 0) 
  		fstreamline__.invoke(null, nextTick, [_], 0);
  	return G(_, code);
  }
  
  function I(_, code){
  	var s = "";
  	for (var i = 0; i < code; i++) 
  		s += H(_, i);
  	return s;
  }
  
  function T(_, fn, code, failFn){
  	fail = failFn;
  	var s = "{"
  	try {
  		return fstreamline__.invoke(null, fn, [_, code], 0);
  	} 
  	catch (ex) {
  		var s = ex.stack;
  		//console.log(ex.rawStack);
  		//console.log(ex.stack);
  		//console.log(s);
  		s = s.split('\n').map(function(l){
  			var m = /^\s+at (\w+)\s\(.*:(\d+)\:.*\)/.exec(l);
  			if (m) 
  				return m[1] + ":" + m[2];
  			return l;
  		}).join('/');
  		var end = s.indexOf('/T:');
  		return end < 0 ? s + "-- end frame missing" : s.substring(0, end);
  	}
  }
  
  module("stacks");
  
  asyncTest("stacks", 20, fstreamline__.create(function(_){
  	strictEqual(T(_, A_, 1, failAsync_), "Error: 1/failAsync:15/A:28");
  	strictEqual(T(_, A_, 1, failSync_), "Error: 1/fail:20/failSync:21/A:28");
  	strictEqual(T(_, A_, 2, failAsync_), "Error: 2/failAsync:15/A:30");
  	strictEqual(T(_, A_, 2, failSync_), "Error: 2/fail:20/failSync:21/A:30");
  	strictEqual(T(_, A_, 3, failAsync_), "Error: 3/failAsync:15/A:33");
  	strictEqual(T(_, A_, 3, failSync_), "Error: 3/fail:20/failSync:21/A:33");
  	strictEqual(T(_, A_, 4, failAsync_), "Error: 4/failAsync:15/A:36");
  	strictEqual(T(_, A_, 4, failSync_), "Error: 4/fail:20/failSync:21/A:36");
  	strictEqual(T(_, A_, 5, failAsync_), "Error: 5/failAsync:15/A:36");
  	strictEqual(T(_, A_, 5, failSync_), "Error: 5/fail:20/failSync:21/A:36");
  	strictEqual(T(_, A_, 6, failAsync_), "Error: 6/failAsync:15/A:40");
  	strictEqual(T(_, A_, 6, failSync_), "Error: 6/fail:20/failSync:21/A:40");
  	strictEqual(T(_, A_, 7, failAsync_), "Error: 7/failAsync:15/B:49/A:42");
  	strictEqual(T(_, A_, 7, failSync_), "Error: 7/fail:20/failSync:21/B:49/A:42");
  	strictEqual(T(_, A_, 8, failAsync_), "Error: 8/failAsync:15/C:58/B:50/A:42");
  	strictEqual(T(_, A_, 8, failSync_), "Error: 8/fail:20/failSync:21/C:58/B:50/A:42");
  	strictEqual(T(_, A_, 9, failAsync_), "Error: 9/failAsync:15/D:63/B:53/A:42");
  	strictEqual(T(_, A_, 9, failSync_), "Error: 9/fail:20/failSync:21/D:63/B:53/A:42");
  	strictEqual(T(_, A_, 10, failAsync_), "END");
  	strictEqual(T(_, A_, 10, failSync_), "END");
  	start();
  }, 0))
  
  asyncTest("catch", 20, fstreamline__.create(function(_){
  	strictEqual(T(_, E_, 1, failAsync_), "Error: 1/failAsync:15/E:72");
  	strictEqual(T(_, E_, 1, failSync_), "Error: 1/fail:20/failSync:21/E:72");
  	strictEqual(T(_, E_, 2, failAsync_), "Error: 2/failAsync:15/A:30/E:74");
  	strictEqual(T(_, E_, 2, failSync_), "Error: 2/fail:20/failSync:21/A:30/E:74");
  	strictEqual(T(_, E_, 3, failAsync_), "OK 3");
  	strictEqual(T(_, E_, 3, failSync_), "OK 3");
  	strictEqual(T(_, E_, 4, failAsync_), "Error: 4/failAsync:15/E:72");
  	strictEqual(T(_, E_, 4, failSync_), "Error: 4/fail:20/failSync:21/E:72");
  	strictEqual(T(_, E_, 5, failAsync_), "Error: 5/failAsync:15/A:36/E:74");
  	strictEqual(T(_, E_, 5, failSync_), "Error: 5/fail:20/failSync:21/A:36/E:74");
  	strictEqual(T(_, E_, 6, failAsync_), "OK 6");
  	strictEqual(T(_, E_, 6, failSync_), "OK 6");
  	strictEqual(T(_, E_, 7, failAsync_), "Error: 7/failAsync:15/E:72");
  	strictEqual(T(_, E_, 7, failSync_), "Error: 7/fail:20/failSync:21/E:72");
  	strictEqual(T(_, E_, 8, failAsync_), "Error: 8/failAsync:15/C:58/B:50/A:42/E:74");
  	strictEqual(T(_, E_, 8, failSync_), "Error: 8/fail:20/failSync:21/C:58/B:50/A:42/E:74");
  	strictEqual(T(_, E_, 9, failAsync_), "OK 9");
  	strictEqual(T(_, E_, 9, failSync_), "OK 9");
  	strictEqual(T(_, E_, 10, failAsync_), "Error: 10/failAsync:15/E:72");
  	strictEqual(T(_, E_, 10, failSync_), "Error: 10/fail:20/failSync:21/E:72");
  	start();
  }, 0))
  
  asyncTest("futures", 20, fstreamline__.create(function(_){
  	strictEqual(T(_, F_, 1, failAsync_), "Error: 1/failAsync:15/A:28/F:83");
  	strictEqual(T(_, F_, 1, failSync_), "Error: 1/fail:20/failSync:21/A:28/F:83");
  	strictEqual(T(_, F_, 2, failAsync_), "Error: 2/failAsync:15/A:30/F:83");
  	strictEqual(T(_, F_, 2, failSync_), "Error: 2/fail:20/failSync:21/A:30/F:83");
  	strictEqual(T(_, F_, 3, failAsync_), "Error: 3/failAsync:15/A:33/F:83");
  	strictEqual(T(_, F_, 3, failSync_), "Error: 3/fail:20/failSync:21/A:33/F:83");
  	strictEqual(T(_, F_, 4, failAsync_), "Error: 4/failAsync:15/A:36/F:83");
  	strictEqual(T(_, F_, 4, failSync_), "Error: 4/fail:20/failSync:21/A:36/F:83");
  	strictEqual(T(_, F_, 5, failAsync_), "Error: 5/failAsync:15/A:36/F:83");
  	strictEqual(T(_, F_, 5, failSync_), "Error: 5/fail:20/failSync:21/A:36/F:83");
  	strictEqual(T(_, F_, 6, failAsync_), "Error: 6/failAsync:15/A:40/F:83");
  	strictEqual(T(_, F_, 6, failSync_), "Error: 6/fail:20/failSync:21/A:40/F:83");
  	strictEqual(T(_, F_, 7, failAsync_), "Error: 7/failAsync:15/B:49/A:42/F:83");
  	strictEqual(T(_, F_, 7, failSync_), "Error: 7/fail:20/failSync:21/B:49/A:42/F:83");
  	strictEqual(T(_, F_, 8, failAsync_), "Error: 8/failAsync:15/C:58/B:50/A:42/F:83");
  	strictEqual(T(_, F_, 8, failSync_), "Error: 8/fail:20/failSync:21/C:58/B:50/A:42/F:83");
  	strictEqual(T(_, F_, 9, failAsync_), "Error: 9/failAsync:15/D:63/B:53/A:42/F:83");
  	strictEqual(T(_, F_, 9, failSync_), "Error: 9/fail:20/failSync:21/D:63/B:53/A:42/F:83");
  	strictEqual(T(_, F_, 10, failAsync_), "END & END");
  	strictEqual(T(_, F_, 10, failSync_), "END & END");
  	start();
  }, 0))
  
  asyncTest("loop", 8, fstreamline__.create(function(_){
  	strictEqual(T(_, I_, 4, failAsync_), "0123");
  	strictEqual(T(_, I_, 4, failSync_), "0123");
  	strictEqual(T(_, I_, 5, failAsync_), "01234");
  	strictEqual(T(_, I_, 5, failSync_), "01234");
  	strictEqual(T(_, I_, 6, failAsync_), "Error: 5/failAsync:15/G:88/H:95/I:101");
  	strictEqual(T(_, I_, 6, failSync_), "Error: 5/fail:20/failSync:21/G:88/H:95/I:101");
  	strictEqual(T(_, I_, 7, failAsync_), "Error: 5/failAsync:15/G:88/H:95/I:101");
  	strictEqual(T(_, I_, 7, failSync_), "Error: 5/fail:20/failSync:21/G:88/H:95/I:101");
  	start();
  }, 0))
  
  
  
  }, 0).call(this, function(err) {
    if (err) throw err;
  }));