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

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

Issue 2591753002: [wasm] Implement correct 2-level namespace for imports. (Closed)
Patch Set: Fix debug tests Created 4 years 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
« no previous file with comments | « test/mjsunit/wasm/test-wasm-module-builder.js ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | 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 27 matching lines...) Expand all
38 } catch (e) { 38 } catch (e) {
39 if (e instanceof URIError) return false; 39 if (e instanceof URIError) return false;
40 throw e; 40 throw e;
41 } 41 }
42 } 42 }
43 43
44 function checkImportsAndExports(imported_module_name, imported_function_name, 44 function checkImportsAndExports(imported_module_name, imported_function_name,
45 internal_function_name, exported_function_name, shouldThrow) { 45 internal_function_name, exported_function_name, shouldThrow) {
46 var builder = new WasmModuleBuilder(); 46 var builder = new WasmModuleBuilder();
47 47
48 builder.addImportWithModule(imported_module_name, imported_function_name, 48 builder.addImport(imported_module_name, imported_function_name,
49 kSig_v_v); 49 kSig_v_v);
50 50
51 builder.addFunction(internal_function_name, kSig_v_v) 51 builder.addFunction(internal_function_name, kSig_v_v)
52 .addBody([kExprCallFunction, 0]) 52 .addBody([kExprCallFunction, 0])
53 .exportAs(exported_function_name); 53 .exportAs(exported_function_name);
54 54
55 // sanity check: does javascript agree with out shouldThrow annotation? 55 // sanity check: does javascript agree with out shouldThrow annotation?
56 assertEquals(shouldThrow, 56 assertEquals(shouldThrow,
57 !isValidUtf8(imported_module_name) || 57 !isValidUtf8(imported_module_name) ||
58 !isValidUtf8(imported_function_name) || 58 !isValidUtf8(imported_function_name) ||
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 checkAll("some math: (½)² = ¼", false); 113 checkAll("some math: (½)² = ¼", false);
114 checkAll("中国历史系列条目\n北", false); 114 checkAll("中国历史系列条目\n北", false);
115 checkAll(toByteArray("\xef\xb7\x8f"), false); 115 checkAll(toByteArray("\xef\xb7\x8f"), false);
116 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);
117 checkAll(toByteArray("\xff"), true); 117 checkAll(toByteArray("\xff"), true);
118 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points 118 checkAll(toByteArray("\xed\xa0\x8f"), true); // surrogate code points
119 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence 119 checkAll(toByteArray("\xe0\x82\x80"), true); // overlong sequence
120 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000 120 checkAll(toByteArray("\xf4\x90\x80\x80"), true); // beyond limit: U+110000
121 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE 121 checkAll(toByteArray("\xef\xbf\xbe"), true); // non-character; U+FFFE
122 checkAll(toByteArray("with\x00null"), false); 122 checkAll(toByteArray("with\x00null"), false);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/test-wasm-module-builder.js ('k') | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698