HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/textanalyse/web_console/node_modules/stop-iteration-iterator/test/index.js
'use strict';

var test = require('tape');

var stopIterationIterator = require('../');

test('stopIterationIterator', function (t) {
	t.equal(typeof stopIterationIterator, 'function', 'stopIterationIterator is a function');

	t.test('no StopIteration support', { skip: typeof StopIteration === 'object' }, function (st) {
		st['throws'](
			function () { stopIterationIterator(); },
			SyntaxError,
			'throws a SyntaxError when StopIteration is not supported'
		);

		st.end();
	});

	t.test('StopIteration support', { skip: typeof StopIteration !== 'object' }, function (st) {
		var s = new Set([1, 2]);

		var i = s.iterator();
		st.equal(i.next(), 1, 'first item is 1');
		st.equal(i.next(), 2, 'second item is 2');
		try {
			i.next();
			st.fail();
		} catch (e) {
			st.equal(e, StopIteration, 'StopIteration thrown');
		}

		var m = new Map([[1, 'a'], [2, 'b']]);
		var mi = m.iterator();
		st.deepEqual(mi.next(), [1, 'a'], 'first item is 1 and a');
		st.deepEqual(mi.next(), [2, 'b'], 'second item is 2 and b');
		try {
			mi.next();
			st.fail();
		} catch (e) {
			st.equal(e, StopIteration, 'StopIteration thrown');
		}

		st.end();
	});

	t.end();
});