common.js (611B)
1 // Helper for tests that just want to verify the ordering of a series of events. 2 // Usage: 3 // log_test(function(t, log) { 4 // log('first'); 5 // log('second'); 6 // }, ['first', 'second'], 'Ordinal numbers are ordinal'); 7 8 function log_test(func, expected, description) { 9 async_test(function(t) { 10 var actual = []; 11 function log(entry) { 12 actual.push(entry); 13 if (expected.length <= actual.length) { 14 assert_array_equals(actual, expected); 15 t.done(); 16 } 17 } 18 func(t, t.step_func(log)); 19 }, description); 20 }