Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Side by Side Diff: test/mjsunit/wasm/unicode-validation.js

Issue 2342623002: [wasm] Set up Table and Memory constructors
Patch Set: Eps Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« test/mjsunit/wasm/table.js ('K') | « test/mjsunit/wasm/table.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 function toByteArray(s) { 10 function toByteArray(s) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ffi[imported_module_name][imported_function_name] = function() { }; 72 ffi[imported_module_name][imported_function_name] = function() { };
73 } 73 }
74 74
75 var hasThrown = true; 75 var hasThrown = true;
76 try { 76 try {
77 builder.instantiate(ffi); 77 builder.instantiate(ffi);
78 hasThrown = false; 78 hasThrown = false;
79 } catch (err) { 79 } catch (err) {
80 if (!shouldThrow) print(err); 80 if (!shouldThrow) print(err);
81 assertTrue(shouldThrow, "Should not throw error on valid names"); 81 assertTrue(shouldThrow, "Should not throw error on valid names");
82 assertTrue(err instanceof Error, "exception should be an Error");
82 assertContains("UTF-8", err.toString()); 83 assertContains("UTF-8", err.toString());
83 } 84 }
84 assertEquals(shouldThrow, hasThrown, 85 assertEquals(shouldThrow, hasThrown,
85 "Should throw validation error on invalid names"); 86 "Should throw validation error on invalid names");
86 } 87 }
87 88
88 function checkImportedModuleName(name, shouldThrow) { 89 function checkImportedModuleName(name, shouldThrow) {
89 checkImportsAndExports(name, "imp", "func", undefined, shouldThrow); 90 checkImportsAndExports(name, "imp", "func", undefined, shouldThrow);
90 } 91 }
91 92
(...skipping 20 matching lines...) Expand all
112 checkAll("some math: (½)² = ¼", false); 113 checkAll("some math: (½)² = ¼", false);
113 checkAll("中国历史系列条目\n北", false); 114 checkAll("中国历史系列条目\n北", false);
114 checkAll(toByteArray("\xef\xb7\x8f"), false); 115 checkAll(toByteArray("\xef\xb7\x8f"), false);
115 checkAll(toByteArray("a\xc2\x81\xe1\x80\xbf\xf1\x80\xa0\xbf"), false); 116 checkAll(toByteArray("a\xc2\x81\xe1\x80\xbf\xf1\x80\xa0\xbf"), false);
116 checkAll(toByteArray("\xff"), true); 117 checkAll(toByteArray("\xff"), true);
117 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points 118 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points
118 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence 119 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence
119 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000 120 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000
120 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE 121 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE
121 checkAll(toByteArray("with\x00null"), false); 122 checkAll(toByteArray("with\x00null"), false);
OLDNEW
« test/mjsunit/wasm/table.js ('K') | « test/mjsunit/wasm/table.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698