mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851982 - Regression test. r=smontagu
This commit is contained in:
parent
87dfe91ba3
commit
2326ce44e4
@ -13,7 +13,7 @@
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
SimpleTest.expectAssertions(0, 2);
|
||||
//SimpleTest.expectAssertions(0, 2);
|
||||
|
||||
setup({explicit_done: true});
|
||||
runTest();
|
||||
|
@ -43,6 +43,7 @@ function runTextDecoderOptions()
|
||||
testDecodeABVOption(data, expectedString);
|
||||
}, "testDecodeABVOption");
|
||||
test(testDecoderForThaiEncoding, "testDecoderForThaiEncoding");
|
||||
test(testInvalid2022JP, "testInvalid2022JP");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -401,3 +402,50 @@ function testCharset(test)
|
||||
}
|
||||
assert_true(!test.error, test.msg);
|
||||
}
|
||||
|
||||
function testInvalid2022JP()
|
||||
{
|
||||
var inputs = [
|
||||
[0x80],
|
||||
[0x1b, 0xFF],
|
||||
[0x1b, 0x28, 0xFF],
|
||||
[0x1b, 0x24, 0x80],
|
||||
[0x1b, 0x24, 0x28, 0x80],
|
||||
[0x1b, 0x28, 0x4a, 0xFF],
|
||||
[0x1b, 0x28, 0x49, 0xFF],
|
||||
[0x1b, 0x24, 0x40, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x20],
|
||||
[0x1b, 0x24, 0x40, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x41, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x42, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0xFF, 0x21],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x80, 0x21],
|
||||
[0x1b, 0x24, 0x40, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x41, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x42, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x43, 0x21, 0x20],
|
||||
[0x1b, 0x24, 0x28, 0x44, 0x21, 0x20],
|
||||
[0x1b, 0x2e, 0xFF],
|
||||
[0x1b, 0x4e, 0x20],
|
||||
[0x1b, 0x4e, 0x7F],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0x80],
|
||||
[0x1b, 0x2e, 0x41, 0x1b, 0x4e, 0xFF],
|
||||
];
|
||||
|
||||
var failureCount = 0;
|
||||
inputs.forEach(function(input) {
|
||||
try {
|
||||
// decode() should never throw unless {fatal: true} is specified
|
||||
new TextDecoder("iso-2022-jp").decode(new Uint8Array(input));
|
||||
} catch (e) {
|
||||
if (e.name !== "EncodingError") {
|
||||
throw e;
|
||||
}
|
||||
failureCount++;
|
||||
}
|
||||
});
|
||||
assert_equals(failureCount, 0, failureCount + " of " + inputs.length + " tests failed");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user