Chromium Code Reviews| Index: test/cctest/test-asm-validator.cc |
| diff --git a/test/cctest/test-asm-validator.cc b/test/cctest/test-asm-validator.cc |
| index 3e6bcd305a2f1f73bb99663978d42bf57daa6e77..7f3b1194ff6e19dbe0f7ea2748165e63dd77e78b 100644 |
| --- a/test/cctest/test-asm-validator.cc |
| +++ b/test/cctest/test-asm-validator.cc |
| @@ -309,6 +309,52 @@ TEST(ValidateMinimum) { |
| } |
| +TEST(MissingUseAsm) { |
| + const char test_function[] = |
| + "function foo() {\n" |
| + " function bar() {}\n" |
| + " return { bar: bar };\n" |
| + "}\n"; |
| + v8::V8::Initialize(); |
| + HandleAndZoneScope handles; |
| + Zone* zone = handles.main_zone(); |
| + ZoneVector<ExpressionTypeEntry> types(zone); |
| + CHECK_EQ("asm: line 1: missing \"use asm\"\n", |
| + Validate(zone, test_function, &types)); |
| +} |
| + |
| + |
| +TEST(WrongUseAsm) { |
| + const char test_function[] = |
| + "function foo() {\n" |
| + " \"use wasm\"\n" |
| + " function bar() {}\n" |
| + " return { bar: bar };\n" |
| + "}\n"; |
| + v8::V8::Initialize(); |
| + HandleAndZoneScope handles; |
| + Zone* zone = handles.main_zone(); |
| + ZoneVector<ExpressionTypeEntry> types(zone); |
| + CHECK_EQ("asm: line 1: missing \"use asm\"\n", |
| + Validate(zone, test_function, &types)); |
| +} |
| + |
| + |
| +TEST(MissingReturnExports) { |
|
aseemgarg
2016/01/08 22:30:56
Is this correct? Although useless, it is not clear
bradn
2016/01/09 01:05:53
Actually it does seem to require a ValidateExports
|
| + const char test_function[] = |
| + "function foo() {\n" |
| + " \"use asm\"\n" |
| + " function bar() {}\n" |
| + "}\n"; |
| + v8::V8::Initialize(); |
| + HandleAndZoneScope handles; |
| + Zone* zone = handles.main_zone(); |
| + ZoneVector<ExpressionTypeEntry> types(zone); |
| + CHECK_EQ("asm: line 2: last statement in module is not a return\n", |
| + Validate(zone, test_function, &types)); |
| +} |
| + |
| + |
| #define HARNESS_STDLIB() \ |
| "var Infinity = stdlib.Infinity;\n" \ |
| "var NaN = stdlib.NaN;\n" \ |