v8/test/mjsunit/regress/regress-797581.js
Oliver Dunk 563290194f Add quotes around unexpected token SyntaxError
Quotes have been added around the token to make the message clearer.

Bug: chromium:943636
Change-Id: Ic38f3e6d307157af2c0146e69fb611a2cfb46564
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593307
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62074}
2019-06-11 06:11:58 +00:00

35 lines
1.3 KiB
JavaScript

// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-dynamic-import
// Resources: test/mjsunit/regress/modules-skip-regress-797581-1.js
// Resources: test/mjsunit/regress/modules-skip-regress-797581-2.js
// Resources: test/mjsunit/regress/modules-skip-regress-797581-3.js
// Resources: test/mjsunit/regress/modules-skip-regress-797581-4.js
// Resources: test/mjsunit/regress/modules-skip-regress-797581-5.js
function TryToLoadModule(filename, expect_error, token) {
let caught_error;
function SetError(e) {
caught_error = e;
}
import(filename).catch(SetError);
%PerformMicrotaskCheckpoint();
if (expect_error) {
assertTrue(caught_error instanceof SyntaxError);
assertEquals("Unexpected token '" + token + "'", caught_error.message);
} else {
assertEquals(undefined, caught_error);
}
}
TryToLoadModule("modules-skip-regress-797581-1.js", true, ")");
TryToLoadModule("modules-skip-regress-797581-2.js", true, ")");
TryToLoadModule("modules-skip-regress-797581-3.js", true, "...");
TryToLoadModule("modules-skip-regress-797581-4.js", true, ",");
TryToLoadModule("modules-skip-regress-797581-5.js", false);