Lines Matching refs:should

4 // For readable stream tests, the factory should return the stream. For reader tests, the factory should return a
26 assert_throws_js(TypeError, () => rs.getReader({ mode: '' }), 'empty string mode should throw');
27 assert_throws_js(TypeError, () => rs.getReader({ mode: null }), 'null mode should throw');
28 assert_throws_js(TypeError, () => rs.getReader({ mode: 'asdf' }), 'asdf mode should throw');
29 assert_throws_js(TypeError, () => rs.getReader(5), '5 should throw');
34 }, label + ': calling getReader with invalid arguments should throw appropriate errors');
46 assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises');
49 cancelPromise1.then(v => assert_equals(v, undefined, 'first cancel() call should fulfill with undefined')),
50 cancelPromise2.then(v => assert_equals(v, undefined, 'second cancel() call should fulfill with undefined'))
53 }, label + ': cancel() should return a distinct fulfilled promise each time');
58 assert_false(rs.locked, 'locked getter should return false');
60 }, label + ': locked should be false');
65 rs.getReader(); // getReader() should not throw.
67 }, label + ': getReader() should be OK');
76 const reader2 = rs.getReader(); // Getting a second reader should not throw.
79 rs.getReader(); // Getting a third reader should not throw.
81 }, label + ': should be able to acquire multiple readers if they are released in succession');
89 assert_throws_js(TypeError, () => rs.getReader(), 'getting a second reader should throw');
90 assert_throws_js(TypeError, () => rs.getReader(), 'getting a third reader should throw');
92 }, label + ': should not be able to acquire a second reader if we don\'t release the first one');
108 }, label + ': getReader() should return a reader that acts errored');
121 }, label + ': read() twice should give the error each time');
126 assert_false(rs.locked, 'locked getter should return false');
127 }, label + ': locked should be false');
141 }, label + ': should be able to obtain a second reader, with the correct closed promise');
148 assert_throws_js(TypeError, () => rs.getReader(), 'getting a second reader should throw a TypeError');
149 assert_throws_js(TypeError, () => rs.getReader(), 'getting a third reader should throw a TypeError');
151 }, label + ': should not be able to obtain additional readers if we don\'t release the first lock');
159 assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises');
166 }, label + ': cancel() should return a distinct rejected promise each time');
175 assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises');
182 }, label + ': reader cancel() should return a distinct rejected promise each time');
205 assert_true(stream.locked, 'locked getter should return true');
207 }, label + ': locked should be true');
214 t.unreached_func('read() should not fulfill'),
215 t.unreached_func('read() should not reject')
220 }, label + ': read() should never settle');
227 t.unreached_func('read() should not fulfill'),
228 t.unreached_func('read() should not reject')
232 t.unreached_func('read() should not fulfill'),
233 t.unreached_func('read() should not reject')
238 }, label + ': two read()s should both never settle');
243 assert_not_equals(reader.read(), reader.read(), 'the promises returned should be distinct');
245 }, label + ': read() should return distinct promises each time');
250 assert_throws_js(TypeError, () => stream.getReader(), 'stream.getReader() should throw a TypeError');
252 }, label + ': getReader() again on the stream should fail');
266 assert_false(stream.locked, 'the stream should be unlocked');
269 promise_rejects_js(t, TypeError, read1, 'first read should reject'),
270 promise_rejects_js(t, TypeError, read2, 'second read should reject'),
271 promise_rejects_js(t, TypeError, closed, 'closed should reject')
274 }, label + ': releasing the lock should reject all pending read requests');
286 }, label + ': releasing the lock should cause further read() calls to reject with a TypeError');
296 assert_equals(closedBefore, closedAfter, 'the closed promise should not change identity');
300 }, label + ': releasing the lock should cause closed calls to reject with a TypeError');
309 assert_false(stream.locked, 'locked getter should return false');
311 }, label + ': releasing the lock should cause locked to become false');
319 assert_object_equals(r, { value: undefined, done: true }, 'read()ing from the reader should give a done result');
322 }, label + ': canceling via the reader should cause the reader to act closed');
329 }, label + ': canceling via the stream should fail');
340 assert_object_equals(v, { value: undefined, done: true }, 'read() should fulfill correctly');
343 }, label + ': read() should fulfill with { value: undefined, done: true }');
351 assert_object_equals(v, { value: undefined, done: true }, 'read() should fulfill correctly');
354 assert_object_equals(v, { value: undefined, done: true }, 'read() should fulfill correctly');
358 }, label + ': read() multiple times should fulfill with { value: undefined, done: true }');
365 assert_object_equals(v, { value: undefined, done: true }, 'read() should fulfill correctly');
368 }, label + ': read() should work when used within another read() fulfill callback');
374 return reader.closed.then(v => assert_equals(v, undefined, 'reader closed should fulfill with undefined'));
376 }, label + ': closed should fulfill with undefined');
386 assert_not_equals(closedBefore, closedAfter, 'the closed promise should change identity');
389 closedBefore.then(v => assert_equals(v, undefined, 'reader.closed acquired before release should fulfill')),
393 }, label + ': releasing the lock should cause closed to reject and change identity');
402 assert_not_equals(cancelPromise1, cancelPromise2, 'cancel() calls should return distinct promises');
403 assert_not_equals(cancelPromise1, closedReaderPromise, 'cancel() promise 1 should be distinct from reader.closed');
404 assert_not_equals(cancelPromise2, closedReaderPromise, 'cancel() promise 2 should be distinct from reader.closed');
407 cancelPromise1.then(v => assert_equals(v, undefined, 'first cancel() should fulfill with undefined')),
408 cancelPromise2.then(v => assert_equals(v, undefined, 'second cancel() should fulfill with undefined'))
411 }, label + ': cancel() should return a distinct fulfilled promise each time');
422 }, label + ': closed should reject with the error');
433 assert_not_equals(closedBefore, closedAfter, 'the closed promise should change identity');
438 }, label + ': releasing the lock should cause closed to reject and change identity');
445 }, label + ': read() should reject with the error');
457 assert_object_equals(r, { value: chunks[0], done: false }, 'first result should be correct');
460 assert_object_equals(r, { value: chunks[1], done: false }, 'second result should be correct');
471 assert_object_equals(r, { value: chunks[0], done: false }, 'first result should be correct');
474 assert_object_equals(r2, { value: chunks[1], done: false }, 'second result should be correct');
483 assert_not_equals(reader.read(), reader.read(), 'the promises returned should be distinct');
485 }, label + ': read() should return distinct promises each time');
492 assert_equals(v, undefined, 'reader closed should fulfill with undefined');
497 'promise returned before cancellation should fulfill with a chunk');
504 'promise returned after cancellation should fulfill with an end-of-stream signal');
509 }, label + ': cancel() after a read() should still give that single read result');
521 assert_object_equals(r, { value: chunks[0], done: false }, 'first result should be correct');
524 assert_object_equals(r, { value: chunks[1], done: false }, 'second result should be correct');
527 assert_object_equals(r, { value: undefined, done: true }, 'third result should be correct');
531 }, label + ': third read(), without waiting, should give { value: undefined, done: true } (sequential)');
538 assert_object_equals(r, { value: chunks[0], done: false }, 'first result should be correct');
541 assert_object_equals(r2, { value: chunks[1], done: false }, 'second result should be correct');
544 assert_object_equals(r3, { value: undefined, done: true }, 'third result should be correct');
549 }, label + ': third read(), without waiting, should give { value: undefined, done: true } (nested)');
557 assert_true(stream.locked, 'stream should start locked');
560 assert_equals(v, undefined, 'reader closed should fulfill with undefined');
561 assert_true(stream.locked, 'stream should remain locked');
570 ': draining the stream via read() should cause the reader closed promise to fulfill, but locked stays true');
579 assert_true(stream.locked, 'the stream should start locked');
580 reader.releaseLock(); // Releasing the lock after reader closed should not throw.
581 assert_false(stream.locked, 'the stream should end unlocked');
589 }, label + ': releasing the lock after the stream is closed should cause locked to become false');
603 }, label + ': releasing the lock should cause further read() calls to reject with a TypeError');
646 'the cancel reason should be an array containing those from the branches');
658 }, `${label}: canceling both branches should aggregate the cancel reasons into an array`);
670 'the cancel reason should be an array containing those from the branches');
682 }, `${label}: canceling both branches in reverse order should aggregate the cancel reasons into an array`);
699 }, `${label}: failing to cancel the original stream should cause cancel() to reject on branches`);
719 }, `${label}: erroring a teed stream should properly handle canceled branches`);