diff options
Diffstat (limited to 'deps/v8/test/cctest/compiler/test-run-variables.cc')
-rw-r--r-- | deps/v8/test/cctest/compiler/test-run-variables.cc | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/deps/v8/test/cctest/compiler/test-run-variables.cc b/deps/v8/test/cctest/compiler/test-run-variables.cc index d1f564a51c..728d60f491 100644 --- a/deps/v8/test/cctest/compiler/test-run-variables.cc +++ b/deps/v8/test/cctest/compiler/test-run-variables.cc @@ -10,38 +10,56 @@ namespace v8 { namespace internal { namespace compiler { -static const char* throws = NULL; - -static const char* load_tests[] = { - "var x = a; r = x", "123", "0", - "var x = (r = x)", "undefined", "undefined", - "var x = (a?1:2); r = x", "1", "2", - "const x = a; r = x", "123", "0", - "const x = (a?3:4); r = x", "3", "4", - "'use strict'; const x = a; r = x", "123", "0", - "'use strict'; const x = (r = x)", throws, throws, - "'use strict'; const x = (a?5:6); r = x", "5", "6", - "'use strict'; let x = a; r = x", "123", "0", - "'use strict'; let x = (r = x)", throws, throws, - "'use strict'; let x = (a?7:8); r = x", "7", "8", - NULL}; +static const char* throws = nullptr; + +static const char* load_tests[] = {"var x = a; r = x", + "123", + "0", + "var x = (r = x)", + "undefined", + "undefined", + "var x = (a?1:2); r = x", + "1", + "2", + "const x = a; r = x", + "123", + "0", + "const x = (a?3:4); r = x", + "3", + "4", + "'use strict'; const x = a; r = x", + "123", + "0", + "'use strict'; const x = (r = x)", + throws, + throws, + "'use strict'; const x = (a?5:6); r = x", + "5", + "6", + "'use strict'; let x = a; r = x", + "123", + "0", + "'use strict'; let x = (r = x)", + throws, + throws, + "'use strict'; let x = (a?7:8); r = x", + "7", + "8", + nullptr}; static const char* store_tests[] = { - "var x = 1; x = a; r = x", "123", "0", - "var x = (a?(x=4,2):3); r = x", "2", "3", - "var x = (a?4:5); x = a; r = x", "123", "0", + "var x = 1; x = a; r = x", "123", "0", "var x = (a?(x=4,2):3); r = x", "2", + "3", "var x = (a?4:5); x = a; r = x", "123", "0", // Assignments to 'const' are SyntaxErrors, handled by the parser, // hence we cannot test them here because they are early errors. - "'use strict'; let x = 1; x = a; r = x", "123", "0", - "'use strict'; let x = (a?(x=4,2):3); r = x", throws, "3", - "'use strict'; let x = (a?4:5); x = a; r = x", "123", "0", - NULL}; - + "'use strict'; let x = 1; x = a; r = x", "123", "0", + "'use strict'; let x = (a?(x=4,2):3); r = x", throws, "3", + "'use strict'; let x = (a?4:5); x = a; r = x", "123", "0", nullptr}; static void RunVariableTests(const char* source, const char* tests[]) { EmbeddedVector<char, 512> buffer; - for (int i = 0; tests[i] != NULL; i += 3) { + for (int i = 0; tests[i] != nullptr; i += 3) { SNPrintF(buffer, source, tests[i]); PrintF("#%d: %s\n", i / 3, buffer.start()); FunctionTester T(buffer.start()); |