| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a8f5191 commit deceb26
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | // From: https://github.com/w3c/web-platform-tests/blob/39a67e2fff/encoding/textdecoder-fatal.html | |
| 4 | + // With the twist that we specifically test for Node.js error codes | ||
| 4 | 5 | ||
| 5 | 6 | const common = require('../common'); | |
| 6 | 7 | ||
@@ -82,21 +83,10 @@ bad.forEach((t) => { | |||
| 82 | 83 | ); | |
| 83 | 84 | }); | |
| 84 | 85 | ||
| 86 | + // TODO(joyeecheung): remove this when WPT is ported | ||
| 85 | 87 | { | |
| 86 | 88 | assert('fatal' in new TextDecoder()); | |
| 87 | 89 | assert.strictEqual(typeof new TextDecoder().fatal, 'boolean'); | |
| 88 | 90 | assert(!new TextDecoder().fatal); | |
| 89 | 91 | assert(new TextDecoder('utf-8', { fatal: true }).fatal); | |
| 90 | 92 | } | |
| 91 | - | ||
| 92 | - { | ||
| 93 | - const notArrayBufferViewExamples = [false, {}, 1, '', new Error()]; | ||
| 94 | - notArrayBufferViewExamples.forEach((invalidInputType) => { | ||
| 95 | - common.expectsError(() => { | ||
| 96 | - new TextDecoder(undefined, null).decode(invalidInputType); | ||
| 97 | - }, { | ||
| 98 | - code: 'ERR_INVALID_ARG_TYPE', | ||
| 99 | - type: TypeError | ||
| 100 | - }); | ||
| 101 | - }); | ||
| 102 | - } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // This tests that ERR_INVALID_ARG_TYPE are thrown when | ||
| 4 | + // invalid arguments are passed to TextDecoder. | ||
| 5 | + | ||
| 6 | + const common = require('../common'); | ||
| 7 | + | ||
| 8 | + { | ||
| 9 | + const notArrayBufferViewExamples = [false, {}, 1, '', new Error()]; | ||
| 10 | + notArrayBufferViewExamples.forEach((invalidInputType) => { | ||
| 11 | + common.expectsError(() => { | ||
| 12 | + new TextDecoder(undefined, null).decode(invalidInputType); | ||
| 13 | + }, { | ||
| 14 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 15 | + type: TypeError | ||
| 16 | + }); | ||
| 17 | + }); | ||
| 18 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments