Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include <cstring> | 5 #include <cstring> |
| 6 #include <functional> | 6 #include <functional> |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/asmjs/asm-typer.h" | 10 #include "src/asmjs/asm-typer.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 } | 500 } |
| 501 | 501 |
| 502 TEST(ErrorsInGlobalVariableDefinition) { | 502 TEST(ErrorsInGlobalVariableDefinition) { |
| 503 const struct { | 503 const struct { |
| 504 const char* decl; | 504 const char* decl; |
| 505 const char* error_message; | 505 const char* error_message; |
| 506 } kTests[] = { | 506 } kTests[] = { |
| 507 {"var v;", "Global variable missing initializer"}, | 507 {"var v;", "Global variable missing initializer"}, |
| 508 {"var v = uninitialized;", "Invalid global variable initializer"}, | 508 {"var v = uninitialized;", "Undeclared identifier in global"}, |
| 509 {"var v = 'use asm';", "type annotation - forbidden literal"}, | 509 {"var v = 'use asm';", "type annotation - forbidden literal"}, |
| 510 {"var v = 4294967296;", " - forbidden literal"}, | 510 {"var v = 4294967296;", " - forbidden literal"}, |
| 511 {"var v = not_fround;", "Invalid global variable initializer"}, | 511 {"var v = not_fround;", "initialize a global must be a const"}, |
|
bradnelson
2016/10/19 21:52:07
Add tests that hit:
Undeclared identifier in retur
John
2016/10/20 15:13:22
Done.
| |
| 512 {"var v = not_fround(1);", "expected call fround(literal)"}, | 512 {"var v = not_fround(1);", "expected call fround(literal)"}, |
| 513 {"var v = __fround__(1.0);", "expected call fround(literal)"}, | 513 {"var v = __fround__(1.0);", "expected call fround(literal)"}, |
| 514 {"var v = fround(1.0, 1.0);", "expected call fround(literal)"}, | 514 {"var v = fround(1.0, 1.0);", "expected call fround(literal)"}, |
| 515 {"var v = fround(not_fround);", "literal argument for call to fround"}, | 515 {"var v = fround(not_fround);", "literal argument for call to fround"}, |
| 516 {"var v = stdlib.nan", "Invalid import"}, | 516 {"var v = stdlib.nan", "Invalid import"}, |
| 517 {"var v = stdlib.Math.nan", "Invalid import"}, | 517 {"var v = stdlib.Math.nan", "Invalid import"}, |
| 518 {"var v = stdlib.Mathh.E", "Invalid import"}, | 518 {"var v = stdlib.Mathh.E", "Invalid import"}, |
| 519 {"var v = stdlib.Math", "Invalid import"}, | 519 {"var v = stdlib.Math", "Invalid import"}, |
| 520 {"var v = Stdlib.Math.E", "Invalid import"}, | 520 {"var v = Stdlib.Math.E", "Invalid import"}, |
| 521 {"var v = stdlib.Math.E[0]", "Invalid import"}, | 521 {"var v = stdlib.Math.E[0]", "Invalid import"}, |
| (...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1992 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { | 1992 for (size_t ii = 0; ii < arraysize(kTests); ++ii) { |
| 1993 if (!ValidationOf(Module(kTests[ii])) | 1993 if (!ValidationOf(Module(kTests[ii])) |
| 1994 ->FailsWithMessage("Can't assign to immutable symbol")) { | 1994 ->FailsWithMessage("Can't assign to immutable symbol")) { |
| 1995 std::cerr << "Test:\n" << kTests[ii]; | 1995 std::cerr << "Test:\n" << kTests[ii]; |
| 1996 CHECK(false); | 1996 CHECK(false); |
| 1997 } | 1997 } |
| 1998 } | 1998 } |
| 1999 } | 1999 } |
| 2000 | 2000 |
| 2001 } // namespace | 2001 } // namespace |
| OLD | NEW |