v8/test/message
Sathya Gunasekaran 1d0693e2eb [callprinter] Correctly point to the incorrect spread arg
The source position is set to the function call (console.log) not the
spread (..x), in the bytecode generator, as the spread operation is
done as part of the CallWithSpread bytecode.

The CallPrinter stops at the function call and doesn't look at the
arguments as well (in CallPrinter::VisitCall) to see if the error is
from an incorrect spread operation.


With this patch, we pass some state to the CallPrinter in the
CallWithSpread error case and check that in CallPrinter::VisitCall
before returning.

For the given source string:
```
x = undefined;
console.log(1, ...x);
```

Previously, the error was -

```
test.js:2: TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator))
console.log(1, ...x);
        ^
TypeError: console.log is not iterable (cannot read property Symbol(Symbol.iterator))
    at test.js:2:9
```


Now, the error is -

```
_test.js:2: TypeError: x is not iterable (cannot read property undefined)
console.log(1, ...x);
                  ^
TypeError: x is not iterable (cannot read property undefined)
    at _test.js:2:9
```

Bug: v8:10038
Change-Id: I199de9997f1d949c6f9b7b4f41d51f422b8b5131
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2037431
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66131}
2020-02-05 11:27:58 +00:00
..
fail [callprinter] Correctly point to the incorrect spread arg 2020-02-05 11:27:58 +00:00
mjsunit [test] Fix {assertNotSame} in mjsunit test harness. 2019-07-03 15:20:57 +00:00
regress/fail [scanner] fix bug with reporting invalid numeric separator 2019-08-08 16:36:36 +00:00
asm-assignment-undeclared.js
asm-assignment-undeclared.out
asm-function-mismatch-def.js
asm-function-mismatch-def.out
asm-function-mismatch-use.js
asm-function-mismatch-use.out
asm-function-redefined.js
asm-function-redefined.out
asm-function-undefined.js
asm-function-undefined.out [asm.js] Fix handling of bogus code after export statement. 2019-02-21 14:37:37 +00:00
asm-function-variable-collision.js
asm-function-variable-collision.out
asm-import-wrong-annotation.js
asm-import-wrong-annotation.out
asm-import-wrong-object.js
asm-import-wrong-object.out
asm-linking-bogus-heap.js
asm-linking-bogus-heap.out Reland "[asmjs] Properly validate asm.js heap sizes" 2018-08-21 09:00:04 +00:00
asm-linking-bogus-stdlib.js
asm-linking-bogus-stdlib.out
asm-linking-missing-heap.js
asm-linking-missing-heap.out
asm-missing-parameter-annotation.js
asm-missing-parameter-annotation.out
asm-missing-return-annotation.js
asm-missing-return-annotation.out
asm-table-mismatch-def.js
asm-table-mismatch-def.out
asm-table-mismatch-use.js
asm-table-mismatch-use.out
asm-table-redefined.js
asm-table-redefined.out
asm-table-undefined.js
asm-table-undefined.out [asm.js] Fix handling of bogus code after export statement. 2019-02-21 14:37:37 +00:00
asm-table-variable-collision.js
asm-table-variable-collision.out
BUILD.gn [build] Add data deps for d8 test suites 2018-03-26 13:44:58 +00:00
empty.js [platform] Allow to memory-map empty files 2019-01-21 16:02:47 +00:00
empty.out [platform] Allow to memory-map empty files 2019-01-21 16:02:47 +00:00
message.status [wasm-simd][liftoff] Fix spills of S128 values on ARM 2020-01-21 18:35:14 +00:00
non-use-strict-hex-escape.js
non-use-strict-hex-escape.out
non-use-strict-octal-escape.js
non-use-strict-octal-escape.out
non-use-strict-uhex-escape.js
non-use-strict-uhex-escape.out
nonstrict-arguments.js
nonstrict-arguments.out
nonstrict-eval.js
nonstrict-eval.out
nonstrict-with.js
nonstrict-with.out
object-binding-pattern-await-computed-name.js [parser] classify binding pattern errors when parsing await expression 2017-12-09 16:29:23 +00:00
object-binding-pattern-await-computed-name.out [parser] classify binding pattern errors when parsing await expression 2017-12-09 16:29:23 +00:00
README.md Remove always-true --harmony-function-tostring runtime flag 2018-10-03 15:04:16 +00:00
strict-octal-indirect-regexp.js
strict-octal-indirect-regexp.out
strict-octal-regexp.js
strict-octal-regexp.out
testcfg.py [test] Remove module pragma in favor of .mjs 2019-06-27 13:25:48 +00:00
try-catch-finally-no-message.js
try-catch-finally-no-message.out
try-catch-finally-return-in-finally.js
try-catch-finally-return-in-finally.out
try-finally-return-in-finally.js
try-finally-return-in-finally.out
wasm-finish-compilation.js [wasm] merge js constants file in module-builder 2019-01-30 22:10:34 +00:00
wasm-finish-compilation.out Reland "Reland "[d8][wasm] Test wasm compilation completion"" 2018-04-10 08:24:27 +00:00
wasm-function-name-async.js [wasm] merge js constants file in module-builder 2019-01-30 22:10:34 +00:00
wasm-function-name-async.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-function-name-streaming.js [wasm] Load module name during streaming compile 2018-03-16 09:01:20 +00:00
wasm-function-name-streaming.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-module-and-function-name-async.js [wasm] merge js constants file in module-builder 2019-01-30 22:10:34 +00:00
wasm-module-and-function-name-async.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-module-and-function-name-streaming.js [wasm] Load module name during streaming compile 2018-03-16 09:01:20 +00:00
wasm-module-and-function-name-streaming.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-module-name-async.js [wasm] merge js constants file in module-builder 2019-01-30 22:10:34 +00:00
wasm-module-name-async.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-module-name-streaming.js [wasm] Load module name during streaming compile 2018-03-16 09:01:20 +00:00
wasm-module-name-streaming.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-no-name-async.js [wasm] merge js constants file in module-builder 2019-01-30 22:10:34 +00:00
wasm-no-name-async.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-no-name-streaming.js [wasm] Load module name during streaming compile 2018-03-16 09:01:20 +00:00
wasm-no-name-streaming.out [wasm] use standard WebAssembly stack trace format 2019-06-11 18:03:24 +00:00
wasm-trace-memory-interpreted.js [wasm-simd] Implement memory tracing for kSimd128 data types 2019-10-11 20:45:21 +00:00
wasm-trace-memory-interpreted.out [wasm-simd] Implement memory tracing for kSimd128 data types 2019-10-11 20:45:21 +00:00
wasm-trace-memory-liftoff.js Reland "[wasm-simd][liftoff] Check CpuFeatures for SIMD support" 2020-02-03 19:43:09 +00:00
wasm-trace-memory-liftoff.out [wasm-simd][liftoff] Implement i32x4.splat 2020-01-29 23:15:55 +00:00
wasm-trace-memory.js [wasm] Adjust flags after changed implications 2020-01-09 16:55:42 +00:00
wasm-trace-memory.out [wasm-simd] Implement memory tracing for kSimd128 data types 2019-10-11 20:45:21 +00:00

JavaScript tests with expected output

Tests in test/message pass if the output matches the expected output. Message tests are particularly useful when checking for exact error messages.

Tests and their expected output must have the same filename, with the .js and .out extension.

foo.js
foo.out

All tests must end with an exception. The test runner does not handle output from multiple runs, e.g., --stress-opt. Without an exception, the output will be generated several times and the comparison will fail.

You can use a regex in the expected output instead of the exact path:

*%(basename)s:7: SyntaxError: Detected cycle while resolving name 'a'

Empty lines are ignored in the comparison, but whitespaces are not.

Exact details of the test runner are in testcfg.py.