-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #10952 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Joyee Cheung <[email protected]>
- Loading branch information
Showing
11 changed files
with
151 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const URLSearchParams = require('url').URLSearchParams; | ||
|
||
const params = new URLSearchParams('a=b&c=d'); | ||
const entries = params.entries(); | ||
assert.strictEqual(typeof entries[Symbol.iterator], 'function'); | ||
assert.strictEqual(entries[Symbol.iterator](), entries); | ||
assert.deepStrictEqual(entries.next(), { | ||
value: ['a', 'b'], | ||
done: false | ||
}); | ||
assert.deepStrictEqual(entries.next(), { | ||
value: ['c', 'd'], | ||
done: false | ||
}); | ||
assert.deepStrictEqual(entries.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
assert.deepStrictEqual(entries.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
|
||
assert.throws(() => { | ||
entries.next.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParamsIterator$/); | ||
assert.throws(() => { | ||
params.entries.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParams$/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const URLSearchParams = require('url').URLSearchParams; | ||
|
||
const params = new URLSearchParams('a=b&c=d'); | ||
const keys = params.keys(); | ||
|
||
assert.strictEqual(typeof keys[Symbol.iterator], 'function'); | ||
assert.strictEqual(keys[Symbol.iterator](), keys); | ||
assert.deepStrictEqual(keys.next(), { | ||
value: 'a', | ||
done: false | ||
}); | ||
assert.deepStrictEqual(keys.next(), { | ||
value: 'c', | ||
done: false | ||
}); | ||
assert.deepStrictEqual(keys.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
assert.deepStrictEqual(keys.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
|
||
assert.throws(() => { | ||
keys.next.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParamsIterator$/); | ||
assert.throws(() => { | ||
params.keys.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParams$/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
const URLSearchParams = require('url').URLSearchParams; | ||
|
||
const params = new URLSearchParams('a=b&c=d'); | ||
const values = params.values(); | ||
|
||
assert.strictEqual(typeof values[Symbol.iterator], 'function'); | ||
assert.strictEqual(values[Symbol.iterator](), values); | ||
assert.deepStrictEqual(values.next(), { | ||
value: 'b', | ||
done: false | ||
}); | ||
assert.deepStrictEqual(values.next(), { | ||
value: 'd', | ||
done: false | ||
}); | ||
assert.deepStrictEqual(values.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
assert.deepStrictEqual(values.next(), { | ||
value: undefined, | ||
done: true | ||
}); | ||
|
||
assert.throws(() => { | ||
values.next.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParamsIterator$/); | ||
assert.throws(() => { | ||
params.values.call(undefined); | ||
}, /^TypeError: Value of `this` is not a URLSearchParams$/); |