v8/test/mjsunit/linecontinuation.js
Mathias Bynens b09b236992 [test] Improve LineContinuation test coverage
The ECMAScript ⊃ JSON proposal doesn’t affect LineContinuation
grammar. These tests verify that the behavior remains the same when
the --harmony-subsume-json feature flag is enabled.

Bug: v8:7418
Change-Id: Iec5cb1bc112f278481ba1202f0c2b8693917843a
Reviewed-on: https://chromium-review.googlesource.com/1067463
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53270}
2018-05-21 20:15:59 +00:00

41 lines
1.1 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.
// https://tc39.github.io/ecma262/#sec-literals-string-literals
//
// LineContinuation ::
// \ LineTerminatorSequence
//
// LineTerminatorSequence ::
// <LF>
// <CR>[lookahead ≠ <LF>]
// <LS>
// <PS>
// <CR><LF>
// LineTerminatorSequence :: <LF>
assertEquals('', eval('"\\\n"'));
assertEquals('', eval("'\\\n'"));
assertEquals('', eval('`\\\n`'));
// LineTerminatorSequence :: <CR>[lookahead ≠ <LF>]
assertEquals('', eval('"\\\r"'));
assertEquals('', eval("'\\\r'"));
assertEquals('', eval('`\\\r`'));
// LineTerminatorSequence :: <LS>
assertEquals('', eval('"\\\u2028"'));
assertEquals('', eval("'\\\u2028'"));
assertEquals('', eval('`\\\u2028`'));
// LineTerminatorSequence :: <PS>
assertEquals('', eval('"\\\u2029"'));
assertEquals('', eval("'\\\u2029'"));
assertEquals('', eval('`\\\u2029`'));
// LineTerminatorSequence :: <CR><LF>
assertEquals('', eval('"\\\r\n"'));
assertEquals('', eval("'\\\r\n'"));
assertEquals('', eval('`\\\r\n`'));