This commit is contained in:
David Fugate 2011-09-12 11:25:23 -07:00
commit 807a3ba1b7
11552 changed files with 554844 additions and 134 deletions

View File

@ -0,0 +1,524 @@
#!/usr/bin/python
# Copyright 2009 the Sputnik authors. All rights reserved.
# This code is governed by the BSD license found in the LICENSE file.
import logging
import optparse
import os
from os import path
import platform
import re
import subprocess
import sys
import tempfile
import time
class SputnikError(Exception):
def __init__(self, message):
self.message = message
def ReportError(s):
raise SputnikError(s)
def BuildOptions():
result = optparse.OptionParser()
result.add_option("--command", default=None, help="The command-line to run")
result.add_option("--tests", default=path.abspath('.'), help="Path to the tests")
result.add_option("--cat", default=False, action="store_true",
help="Print test source code")
result.add_option("--summary", default=False, action="store_true",
help="Print summary after running tests")
result.add_option("--full-summary", default=False, action="store_true",
help="Print summary and test output after running tests")
result.add_option("--enable-strict-mode", default=False, action="store_true",
help="Run the mode also in ES5 strict mode")
return result
def ValidateOptions(options):
if not options.command:
ReportError("A --command must be specified.")
if not path.exists(options.tests):
ReportError("Couldn't find test path '%s'" % options.tests)
_PLACEHOLDER_PATTERN = re.compile(r"\{\{(\w+)\}\}")
_INCLUDE_PATTERN = re.compile(r"\$INCLUDE\(\"(.*)\"\);")
_SPECIAL_CALL_PATTERN = re.compile(r"\$([A-Z]+)(?=\()")
_SPECIAL_CALLS = {
'ERROR': 'testFailed',
'FAIL': 'testFailed',
'PRINT': 'testPrint'
}
def IsWindows():
p = platform.system()
return (p == 'Windows') or (p == 'Microsoft')
def StripHeader(str):
while str.startswith('//') and "\n" in str:
str = str[str.index("\n")+1:]
return str.lstrip()
class TempFile(object):
def __init__(self, suffix="", prefix="tmp", text=False):
self.suffix = suffix
self.prefix = prefix
self.text = text
self.fd = None
self.name = None
self.is_closed = False
self.Open()
def Open(self):
(self.fd, self.name) = tempfile.mkstemp(
suffix = self.suffix,
prefix = self.prefix,
text = self.text
)
def Write(self, str):
os.write(self.fd, str)
def Read(self):
f = file(self.name)
result = f.read()
f.close()
return result
def Close(self):
if not self.is_closed:
self.is_closed = True
os.close(self.fd)
def Dispose(self):
try:
self.Close()
os.unlink(self.name)
except OSError, e:
logging.error("Error disposing temp file: %s", str(e))
class TestResult(object):
def __init__(self, exit_code, stdout, stderr, case):
self.exit_code = exit_code
self.stdout = stdout
self.stderr = stderr
self.case = case
def ReportOutcome(self, long_format):
name = self.case.GetName()
if self.HasUnexpectedOutcome():
if self.case.IsNegative():
print "%s was expected to fail but didn't" % name
elif (self.case.strict_mode and self.case.IsStrictModeNegative()):
print "%s was expected to fail in strict mode, but didn't" % name
else:
if long_format:
print "=== %s failed ===" % name
else:
print "%s: " % name
out = self.stdout.strip()
if len(out) > 0:
print "--- output ---"
print out
err = self.stderr.strip()
if len(err) > 0:
print "--- errors ---"
print err
if long_format:
print "==="
elif self.case.IsNegative():
print "%s failed as expected" % name
elif self.case.strict_mode:
if self.case.IsStrictModeNegative():
print "%s failed in strict mode as expected" % name
else:
print "%s passed in strict mode" % name
else:
print "%s passed" % name
def HasFailed(self):
return self.exit_code != 0
def HasUnexpectedOutcome(self):
if self.case.IsNegative():
return not self.HasFailed()
if self.case.IsStrictModeNegative():
return not self.HasFailed()
else:
return self.HasFailed()
class TestCase(object):
def __init__(self, suite, name, full_path, strict_mode=False):
self.suite = suite
self.name = name
self.full_path = full_path
self.contents = None
self.is_negative = None
self.strict_mode = strict_mode
self.is_strict_mode_negative = None
def GetName(self):
return path.join(*self.name)
def GetPath(self):
return self.name
def GetRawContents(self):
if self.contents is None:
f = open(self.full_path)
self.contents = f.read()
f.close()
return self.contents
def IsNegative(self):
if self.is_negative is None:
self.is_negative = ("@negative" in self.GetRawContents())
return self.is_negative
def IsStrictModeNegative(self):
if self.strict_mode and self.is_strict_mode_negative is None:
self.is_strict_mode_negative = ("@strict_mode_negative" in self.GetRawContents())
return self.is_strict_mode_negative
def GetSource(self):
source = self.suite.GetInclude("framework.js", False)
source += StripHeader(self.GetRawContents())
def IncludeFile(match):
return self.suite.GetInclude(match.group(1))
source = _INCLUDE_PATTERN.sub(IncludeFile, source)
def SpecialCall(match):
key = match.group(1)
return _SPECIAL_CALLS.get(key, match.group(0))
if self.strict_mode:
source = '"use strict";\nvar strict_mode = true;\n' + _SPECIAL_CALL_PATTERN.sub(SpecialCall, source)
else:
source = "var strict_mode = false; \n" + _SPECIAL_CALL_PATTERN.sub(SpecialCall, source)
return source
def InstantiateTemplate(self, template, params):
def GetParameter(match):
key = match.group(1)
return params.get(key, match.group(0))
return _PLACEHOLDER_PATTERN.sub(GetParameter, template)
def RunTestIn(self, command_template, tmp):
tmp.Write(self.GetSource())
tmp.Close()
command = self.InstantiateTemplate(command_template, {
'path': tmp.name
})
(code, out, err) = self.Execute(command)
return TestResult(code, out, err, self)
def Execute(self, command):
if IsWindows():
args = '"%s"' % command
else:
args = command.split(" ")
stdout = TempFile(prefix="sputnik-out-")
stderr = TempFile(prefix="sputnik-err-")
try:
logging.info("exec: %s", str(args))
process = subprocess.Popen(
args,
shell = IsWindows(),
stdout = stdout.fd,
stderr = stderr.fd
)
code = process.wait()
out = stdout.Read()
err = stderr.Read()
finally:
stdout.Dispose()
stderr.Dispose()
return (code, out, err)
def Run(self, command_template):
tmp = TempFile(suffix=".js", prefix="sputnik-", text=True)
try:
result = self.RunTestIn(command_template, tmp)
finally:
tmp.Dispose()
return result
def Print(self):
print self.GetSource()
class ProgressIndicator(object):
def __init__(self, count):
self.count = count
self.succeeded = 0
self.failed = 0
self.failed_tests = []
def HasRun(self, result):
result.ReportOutcome(True)
if result.HasUnexpectedOutcome():
self.failed += 1
self.failed_tests.append(result)
else:
self.succeeded += 1
def MakePlural(n):
if (n == 1):
return (n, "")
else:
return (n, "s")
class TestSuite(object):
def __init__(self, root, stric_mode):
self.test_root = path.join(root, 'tests', 'Conformance')
self.lib_root = path.join(root, 'lib')
self.strict_mode = stric_mode
self.include_cache = { }
def Validate(self):
if not path.exists(self.test_root):
ReportError("No test repository found")
if not path.exists(self.lib_root):
ReportError("No test library found")
def IsHidden(self, path):
return path.startswith('.') or path == 'CVS'
def IsTestCase(self, path):
return path.endswith('.js')
def ShouldRun(self, rel_path, tests):
if len(tests) == 0:
return True
for test in tests:
if test in rel_path:
return True
return False
def GetTimeZoneInfoInclude(self):
dst_attribs = GetDaylightSavingsAttribs()
if not dst_attribs:
return None
lines = []
for key in sorted(dst_attribs.keys()):
lines.append('var $DST_%s = %s;' % (key, str(dst_attribs[key])))
localtz = time.timezone / -3600
lines.append('var $LocalTZ = %i;' % localtz)
return "\n".join(lines)
def GetSpecialInclude(self, name):
if name == "environment.js":
return self.GetTimeZoneInfoInclude()
else:
return None
def GetInclude(self, name, strip_header=True):
key = (name, strip_header)
if not key in self.include_cache:
value = self.GetSpecialInclude(name)
if value:
self.include_cache[key] = value
else:
static = path.join(self.lib_root, name)
if path.exists(static):
f = open(static)
contents = f.read()
if strip_header:
contents = StripHeader(contents)
self.include_cache[key] = contents + "\n"
f.close()
else:
self.include_cache[key] = ""
return self.include_cache[key]
def EnumerateTests(self, tests):
logging.info("Listing tests in %s", self.test_root)
cases = []
for root, dirs, files in os.walk(self.test_root):
for f in [x for x in dirs if self.IsHidden(x)]:
dirs.remove(f)
dirs.sort()
for f in sorted(files):
if self.IsTestCase(f):
full_path = path.join(root, f)
if full_path.startswith(self.test_root):
rel_path = full_path[len(self.test_root)+1:]
else:
logging.warning("Unexpected path %s", full_path)
rel_path = full_path
if self.ShouldRun(rel_path, tests):
basename = path.basename(full_path)[:-3]
name = rel_path.split(path.sep)[:-1] + [basename]
cases.append(TestCase(self, name, full_path, False))
if self.strict_mode:
cases.append(TestCase(self, name, full_path, True))
logging.info("Done listing tests")
return cases
def PrintSummary(self, progress):
print
print "=== Summary ==="
count = progress.count
succeeded = progress.succeeded
failed = progress.failed
print " - Ran %i test%s" % MakePlural(count)
if progress.failed == 0:
print " - All tests succeeded"
else:
percent = ((100.0 * succeeded) / count,)
print " - Passed %i test%s (%.1f%%)" % (MakePlural(succeeded) + percent)
percent = ((100.0 * failed) / count,)
print " - Failed %i test%s (%.1f%%)" % (MakePlural(failed) + percent)
positive = [c for c in progress.failed_tests if not c.case.IsNegative()]
negative = [c for c in progress.failed_tests if c.case.IsNegative()]
if len(positive) > 0:
print
print "Failed tests"
for result in positive:
print " %s" % result.case.GetName()
if len(negative) > 0:
print
print "Expected to fail but passed ---"
for result in negative:
print " %s" % result.case.GetName()
def PrintFailureOutput(self, progress):
for result in progress.failed_tests:
print
result.ReportOutcome(False)
def Run(self, command_template, tests, print_summary, full_summary):
if not "{{path}}" in command_template:
command_template += " {{path}}"
cases = self.EnumerateTests(tests)
if len(cases) == 0:
ReportError("No tests to run")
progress = ProgressIndicator(len(cases))
for case in cases:
result = case.Run(command_template)
progress.HasRun(result)
if print_summary:
self.PrintSummary(progress)
if full_summary:
self.PrintFailureOutput(progress)
else:
print
print "Use --full-summary to see output from failed tests"
print
def Print(self, tests):
cases = self.EnumerateTests(tests)
if len(cases) > 0:
cases[0].Print()
def GetDaylightSavingsTimes():
# Is the given floating-point time in DST?
def IsDst(t):
return time.localtime(t)[-1]
# Binary search to find an interval between the two times no greater than
# delta where DST switches, returning the midpoint.
def FindBetween(start, end, delta):
while end - start > delta:
middle = (end + start) / 2
if IsDst(middle) == IsDst(start):
start = middle
else:
end = middle
return (start + end) / 2
now = time.time()
one_month = (30 * 24 * 60 * 60)
# First find a date with different daylight savings. To avoid corner cases
# we try four months before and after today.
after = now + 4 * one_month
before = now - 4 * one_month
if IsDst(now) == IsDst(before) and IsDst(now) == IsDst(after):
logging.warning("Was unable to determine DST info.")
return None
# Determine when the change occurs between now and the date we just found
# in a different DST.
if IsDst(now) != IsDst(before):
first = FindBetween(before, now, 1)
else:
first = FindBetween(now, after, 1)
# Determine when the change occurs between three and nine months from the
# first.
second = FindBetween(first + 3 * one_month, first + 9 * one_month, 1)
# Find out which switch is into and which if out of DST
if IsDst(first - 1) and not IsDst(first + 1):
start = second
end = first
else:
start = first
end = second
return (start, end)
def GetDaylightSavingsAttribs():
times = GetDaylightSavingsTimes()
if not times:
return None
(start, end) = times
def DstMonth(t):
return time.localtime(t)[1] - 1
def DstHour(t):
return time.localtime(t - 1)[3] + 1
def DstSunday(t):
if time.localtime(t)[2] > 15:
return "'last'"
else:
return "'first'"
def DstMinutes(t):
return (time.localtime(t - 1)[4] + 1) % 60
attribs = { }
attribs['start_month'] = DstMonth(start)
attribs['end_month'] = DstMonth(end)
attribs['start_sunday'] = DstSunday(start)
attribs['end_sunday'] = DstSunday(end)
attribs['start_hour'] = DstHour(start)
attribs['end_hour'] = DstHour(end)
attribs['start_minutes'] = DstMinutes(start)
attribs['end_minutes'] = DstMinutes(end)
return attribs
def Main():
parser = BuildOptions()
(options, args) = parser.parse_args()
ValidateOptions(options)
test_suite = TestSuite(options.tests, options.enable_strict_mode)
test_suite.Validate()
if options.cat:
test_suite.Print(args)
else:
test_suite.Run(options.command, args,
options.summary or options.full_summary,
options.full_summary)
if __name__ == '__main__':
try:
Main()
sys.exit(0)
except SputnikError, e:
print "Error: %s" % e.message
sys.exit(1)

79
test/harness/framework.js Normal file
View File

@ -0,0 +1,79 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function Test262Error(message) {
this.message = message;
}
Test262Error.prototype.toString = function () {
return "Test262 Error: " + this.message;
};
function testFailed(message) {
throw new Test262Error(message);
}
function testPrint(message) {
}
/**
* It is not yet clear that runTestCase should pass the global object
* as the 'this' binding in the call to testcase.
*/
var runTestCase = (function(global) {
return function(testcase) {
if (!testcase.call(global)) {
testFailed('test function returned falsy');
}
};
})(this);
function assertTruthy(value) {
if (!value) {
testFailed('test return falsy');
}
}
/**
* falsy means we expect no error.
* truthy means we expect some error.
* A non-empty string means we expect an error whose .name is that string.
*/
var expectedErrorName = false;
/**
* What was thrown, or the string 'Falsy' if something falsy was thrown.
* null if test completed normally.
*/
var actualError = null;
function testStarted(expectedErrName) {
expectedErrorName = expectedErrName;
}
function testFinished() {
var actualErrorName = actualError && (actualError.name ||
'SomethingThrown');
if (actualErrorName) {
if (expectedErrorName) {
if (typeof expectedErrorName === 'string') {
if (expectedErrorName === actualErrorName) {
return;
}
testFailed('Threw ' + actualErrorName +
' instead of ' + expectedErrorName);
}
return;
}
throw actualError;
}
if (expectedErrorName) {
if (typeof expectedErrorName === 'string') {
testFailed('Completed instead of throwing ' +
expectedErrorName);
}
testFailed('Completed instead of throwing');
}
}

View File

@ -2,16 +2,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
function SputnikError(message) {
function Test262Error(message) {
if (message) this.message = message;
}
SputnikError.prototype.toString = function () {
Test262Error.prototype.toString = function () {
return "Test262 Error: " + this.message;
};
function testFailed(message) {
throw new SputnikError(message);
throw new Test262Error(message);
}
@ -47,8 +47,8 @@ function $FAIL(message) {
function getPrecision(num)
{
//TODO: Create a table of prec's,
// because using Math for testing Math isn't that correct.
// because using Math for testing Math isn't that correct.
log2num = Math.log(Math.abs(num))/Math.LN2;
pernum = Math.ceil(log2num);
return(2 * Math.pow(2, -52 + pernum));
@ -71,7 +71,7 @@ function isEqual(num1, num2)
{
return(true);
}
prec = getPrecision(Math.min(Math.abs(num1), Math.abs(num2)));
prec = getPrecision(Math.min(Math.abs(num1), Math.abs(num2)));
return(Math.abs(num1 - num2) <= prec);
//return(num1 === num2);
}
@ -86,10 +86,10 @@ function ToInteger(p) {
if(isNaN(x)){
return +0;
}
if((x === +0)
|| (x === -0)
|| (x === Number.POSITIVE_INFINITY)
if((x === +0)
|| (x === -0)
|| (x === Number.POSITIVE_INFINITY)
|| (x === Number.NEGATIVE_INFINITY)){
return x;
}
@ -170,10 +170,10 @@ function YearFromTime(t) {
t = Number(t);
var sign = ( t < 0 ) ? -1 : 1;
var year = ( sign < 0 ) ? 1969 : 1970;
for(var time = 0;;year += sign){
time = TimeFromYear(year);
if(sign > 0 && time > t){
year -= sign;
break;
@ -184,11 +184,11 @@ function YearFromTime(t) {
};
return year;
}
function InLeapYear(t){
if(DaysInYear(YearFromTime(t)) == 365)
return 0;
if(DaysInYear(YearFromTime(t)) == 366)
return 1;
}
@ -247,7 +247,7 @@ var LocalTZA = $LocalTZ*msPerHour;
function DaysInMonth(m, leap) {
m = m%12;
//April, June, Sept, Nov
if(m == 3 || m == 5 || m == 8 || m == 10 ) {
return 30;
@ -266,7 +266,7 @@ function GetSundayInMonth(t, m, count){
var year = YearFromTime(t);
var leap = InLeapYear(t);
var day = 0;
if(m >= 1) day += DaysInMonth(0, leap);
if(m >= 2) day += DaysInMonth(1, leap);
if(m >= 3) day += DaysInMonth(2, leap);
@ -278,25 +278,25 @@ function GetSundayInMonth(t, m, count){
if(m >= 9) day += DaysInMonth(8, leap);
if(m >= 10) day += DaysInMonth(9, leap);
if(m >= 11) day += DaysInMonth(10, leap);
var month_start = TimeFromYear(year)+day*msPerDay;
var sunday = 0;
if(count === "last"){
for(var last_sunday = month_start+DaysInMonth(m, leap)*msPerDay;
for(var last_sunday = month_start+DaysInMonth(m, leap)*msPerDay;
WeekDay(last_sunday)>0;
last_sunday -= msPerDay
){};
sunday = last_sunday;
}
else {
for(var first_sunday = month_start;
for(var first_sunday = month_start;
WeekDay(first_sunday)>0;
first_sunday += msPerDay
){};
sunday = first_sunday+7*msPerDay*(count-1);
}
return sunday;
}
@ -306,9 +306,9 @@ function DaylightSavingTA(t) {
var DST_start = GetSundayInMonth(t, $DST_start_month, $DST_start_sunday)
+$DST_start_hour*msPerHour
+$DST_start_minutes*msPerMinute;
var k = new Date(DST_start);
var DST_end = GetSundayInMonth(t, $DST_end_month, $DST_end_sunday)
+$DST_end_hour*msPerHour
+$DST_end_minutes*msPerMinute;
@ -412,7 +412,7 @@ function MakeDate( day, time ) {
if(!isFinite(day) || !isFinite(time)) {
return Number.NaN;
}
return day*msPerDay+time;
}
@ -445,20 +445,20 @@ function ConstructDate(year, month, date, hours, minutes, seconds, ms){
var r1 = Number(year);
var r2 = Number(month);
var r3 = ((date && arguments.length > 2) ? Number(date) : 1);
var r4 = ((hours && arguments.length > 3) ? Number(hours) : 0);
var r5 = ((minutes && arguments.length > 4) ? Number(minutes) : 0);
var r6 = ((seconds && arguments.length > 5) ? Number(seconds) : 0);
var r4 = ((hours && arguments.length > 3) ? Number(hours) : 0);
var r5 = ((minutes && arguments.length > 4) ? Number(minutes) : 0);
var r6 = ((seconds && arguments.length > 5) ? Number(seconds) : 0);
var r7 = ((ms && arguments.length > 6) ? Number(ms) : 0);
var r8 = r1;
if(!isNaN(r1) && (0 <= ToInteger(r1)) && (ToInteger(r1) <= 99))
r8 = 1900+r1;
var r9 = MakeDay(r8, r2, r3);
var r10 = MakeTime(r4, r5, r6, r7);
var r11 = MakeDate(r9, r10);
return TimeClip(UTC(r11));
}
@ -466,9 +466,9 @@ function ConstructDate(year, month, date, hours, minutes, seconds, ms){
/**** Python code for initialize the above constants
// We may want to replicate the following in JavaScript.
// However, using JS date operations to generate parameters that are then used to
// However, using JS date operations to generate parameters that are then used to
// test those some date operations seems unsound. However, it isn't clear if there
//is a good interoperable alternative.
//is a good interoperable alternative.
# Copyright 2009 the Sputnik authors. All rights reserved.
# This code is governed by the BSD license found in the LICENSE file.

View File

@ -1,14 +1,14 @@
/// Copyright (c) 2009 Microsoft Corporation
///
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
@ -16,7 +16,7 @@
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------
function compareArray(aExpected, aActual) {
@ -121,10 +121,10 @@ function fnGlobalObject() {
//-----------------------------------------------------------------------------
function fnSupportsStrict() {
"use strict";
try {
eval('with ({}) {}');
try {
eval('with ({}) {}');
return false;
} catch (e) {
} catch (e) {
return true;
}
}

View File

@ -1,14 +1,14 @@
/// Copyright (c) 2009 Microsoft Corporation
///
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
@ -16,7 +16,7 @@
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//Do not cache any JSON files - see https://bugs.ecmascript.org/show_bug.cgi?id=87
$.ajaxSetup( {cache:false});
@ -68,7 +68,7 @@ function BrowserRunner() {
currentTest.description = "Failed to load test case!";
} else if((typeof currentTest.error) !== "undefined") {
// We have an error logged from testRun.
if(currentTest.error instanceof SputnikError) {
if(currentTest.error instanceof Test262Error) {
currentTest.error = currentTest.message;
} else {
currentTest.error = currentTest.error.name + ": " + currentTest.error.message;
@ -119,11 +119,11 @@ function BrowserRunner() {
// Set up some globals.
iwin.testRun = testRun;
iwin.testFinished = testFinished;
//TODO: these should be moved to sta.js
var includes = code.match(/\$INCLUDE\(([^\)]+)\)/g), // find all of the $INCLUDE statements
include;
iwin.SputnikError = SputnikError;
iwin.Test262Error = Test262Error;
iwin.$ERROR = $ERROR;
iwin.$FAIL = $FAIL;
iwin.$PRINT = function () {};
@ -139,15 +139,15 @@ function BrowserRunner() {
$.ajax({
async: false,
url: 'resources/scripts/global/' + include,
success: function(s) { scriptCache[include] = s }
})
success: function(s) { scriptCache[include] = s; }
});
}
// Finally, write the required script to the window.
idoc.writeln("<script type='text/javascript'>" + scriptCache[include] + "</script>");
}
}
//Write out all of our helper functions
//idoc.writeln("<script type='text/javascript' src='harness/sta.js'>" + "</script>");
idoc.writeln("<script type='text/javascript'>");
@ -163,13 +163,13 @@ function BrowserRunner() {
testDescrip.path = test.path;
testDescrip.code = code;
iwin.testDescrip = testDescrip;
//Add an error handler capable of catching so-called early errors
//idoc.writeln("<script type='text/javascript' src='harness/ed.js'>" + "</script>");
idoc.writeln("<script type='text/javascript'>");
idoc.writeln(errorDetectorFileContents);
idoc.writeln("</script>");
//Run the code
idoc.writeln("<script type='text/javascript'>");
if (/opera/i.test(navigator.userAgent)) { //Opera doesn't support window.onerror
@ -238,9 +238,9 @@ function TestLoader() {
$.ajax({url: group.path, dataType: 'json', success: function(data) {
group.tests = data.testsCollection.tests;
loader.getNextTest();
},
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
//alert(XMLHttpRequest);
//alert(XMLHttpRequest);
}
});
@ -257,13 +257,13 @@ function TestLoader() {
loader.version = data.version;
loader.date = data.date;
loader.totalTests = data.numTests;
loader.totalTests = data.numTests;
for (var i = 0; i < testSuite.length; i++) {
testGroups[i] = {
path: testSuite[i],
tests: []
}
};
}
loader.onInitialized(loader.totalTests, loader.version, loader.date);
getNextXML();
@ -290,13 +290,13 @@ function TestLoader() {
// We're done.
loader.onTestsExhausted();
}
}
};
/* Start over at the beginning */
this.reset = function() {
currentTestIndex = 0;
testGroupIndex = 0;
}
};
@ -330,22 +330,22 @@ function Controller() {
if(state === 'running')
setTimeout(loader.getNextTest, 10);
}
};
loader.onInitialized = function(totalTests, version, date) {
presenter.setVersion(version);
presenter.setDate(date);
presenter.setTotalTests(totalTests);
}
};
loader.onLoadingNextSection = function(path) {
presenter.updateStatus("Loading: " + path);
}
};
loader.onTestReady = function(testObj, testSrc) {
presenter.updateStatus("Running Test: " + testObj.id);
runner.run(testObj, testSrc);
}
};
loader.onTestsExhausted = function() {
state = 'stopped';
@ -363,20 +363,20 @@ function Controller() {
startTime = new Date();
loader.getNextTest();
presenter.started();
}
};
this.pause = function() {
elapsed += new Date() - startTime;
state = 'paused';
presenter.paused();
}
};
this.reset = function() {
startTime = new Date();
elapsed = 0;
loader.reset();
presenter.reset();
}
};
this.toggle = function() {
if(state === 'running') {
@ -384,16 +384,16 @@ function Controller() {
} else {
controller.start();
}
}
};
}
var controller = new Controller()
var controller = new Controller();
/* Helper function which shows if we're in the 'debug' mode of the Test262 site.
This mode is only useful for debugging issues with the test harness and
This mode is only useful for debugging issues with the test harness and
website. */
function isSiteDebugMode() {
var str=window.location.href.substring(window.location.href.indexOf("?")+1)
var str=window.location.href.substring(window.location.href.indexOf("?")+1);
if(str.indexOf("sitedebug") > -1) {
return true;
}
@ -423,7 +423,7 @@ $(function () {
$(this).attr('targetDiv', '.content-browsers');
}
//Attaching the click event to the header tab that shows the respective div of header
//Attaching the click event to the header tab that shows the respective div of header
$(this).click(function () {
var target = $(this).attr('targetDiv');
$('#contentContainer > div:visible').hide();

View File

@ -1,4 +1,4 @@
this.GlobalScopeTests = this.GlobalScopeTests || new Array();
this.GlobalScopeTests = this.GlobalScopeTests || {};
GlobalScopeTests["TestCases/07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T1.js"]={"assertion":"White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \\u plus four hexadecimal digits","description":"Use TAB (U+0009)","negative":"."};
GlobalScopeTests["TestCases/07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T2.js"]={"assertion":"White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \\u plus four hexadecimal digits","description":"Use VERTICAL TAB (U+000B)","negative":"."};
GlobalScopeTests["TestCases/07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T3.js"]={"assertion":"White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \\u plus four hexadecimal digits","description":"Use FORM FEED (U+000C)","negative":"."};

View File

@ -0,0 +1,41 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* HORIZONTAL TAB (U+0009) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.1_T1.js
* @description Insert HORIZONTAL TAB(\u0009 and \t) between tokens of var x=1
*/
// CHECK#1
eval("\u0009var\u0009x\u0009=\u00091\u0009");
if (x !== 1) {
$ERROR('#1: eval("\\u0009var\\u0009x\\u0009=\\u00091\\u0009"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u0009" + "var" + "\u0009" + "x" + "\u0009" + "=" + "\u0009" + "1" + "\u0009");
if (x !== 1) {
$ERROR('#2: eval("\\u0009" + "var" + "\\u0009" + "x" + "\\u0009" + "=" + "\\u0009" + "1" + "\\u0009"); x === 1. Actual: ' + (x));
}
//CHECK#3
eval("\tvar\tx\t=\t1\t");
if (x !== 1) {
$ERROR('#3: eval("\\tvar\\tx\\t=\\t1\\t"); x === 1. Actual: ' + (x));
}
//CHECK#4
eval("\t" + "var" + "\t" + "x" + "\t" + "=" + "\t" + "1" + "\t");
if (x !== 1) {
$ERROR('#4: eval("\\t" + "var" + "\\t" + "x" + "\\t" + "=" + "\\t" + "1" + "\\t"); x === 1. Actual: ' + (x));
}
//CHECK#5
eval("\u0009" + "var" + "\t" + "x" + "\u0009" + "=" + "\t" + "1" + "\u0009");
if (x !== 1) {
$ERROR('#5: eval("\\u0009" + "var" + "\\t" + "x" + "\\u0009" + "=" + "\\t" + "1" + "\\u0009"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* HORIZONTAL TAB (U+0009) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.1_T2.js
* @description Insert real HORIZONTAL TAB between tokens of var x=1
*/
//CHECK#1
var x = 1 ;
if (x !== 1) {
$ERROR('#1: var x = 1 ; x === 1. Actual: ' + (x));
}
//CHECK#2
eval(" var\tx =\t2 ");
if (x !== 2) {
$ERROR('#2: var\\tx =\\t1 ; x === 2. Actual: ' + (x));
}

View File

@ -0,0 +1,41 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* VERTICAL TAB (U+000B) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.2_T1.js
* @description Insert VERTICAL TAB(\u000B and \v) between tokens of var x=1
*/
// CHECK#1
eval("\u000Bvar\u000Bx\u000B=\u000B1\u000B");
if (x !== 1) {
$ERROR('#1: eval("\\u000Bvar\\u000Bx\\u000B=\\u000B1\\u000B"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u000B" + "var" + "\u000B" + "x" + "\u000B" + "=" + "\u000B" + "1" + "\u000B");
if (x !== 1) {
$ERROR('#2: eval("\\u000B" + "var" + "\\u000B" + "x" + "\\u000B" + "=" + "\\u000B" + "1" + "\\u000B"); x === 1. Actual: ' + (x));
}
//CHECK#3
eval("\vvar\vx\v=\v1\v");
if (x !== 1) {
$ERROR('#3: eval("\\vvar\\vx\\v=\\v1\\v"); x === 1. Actual: ' + (x));
}
//CHECK#4
eval("\v" + "var" + "\v" + "x" + "\v" + "=" + "\v" + "1" + "\v");
if (x !== 1) {
$ERROR('#4: eval("\\v" + "var" + "\\v" + "x" + "\\v" + "=" + "\\v" + "1" + "\\v"); x === 1. Actual: ' + (x));
}
//CHECK#5
eval("\u000B" + "var" + "\v" + "x" + "\u000B" + "=" + "\v" + "1" + "\u000B");
if (x !== 1) {
$ERROR('#5: eval("\\u000B" + "var" + "\\v" + "x" + "\\u000B" + "=" + "\\v" + "1" + "\\u000B"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* VERTICAL TAB (U+000B) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.2_T2.js
* @description Insert real VERTICAL TAB between tokens of var x=1
*/
//CHECK#1
var x = 1 ;
if (x !== 1) {
$ERROR('#1: var x = 1 ; x === 1. Actual: ' + (x));
}
//CHECK#2
eval(" var\vx =\v1 ");
if (x !== 1) {
$ERROR('#2: var\\vx =\\v1 ; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,41 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* FORM FEED (U+000C) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.3_T1.js
* @description Insert FORM FEED(\u000C and \f) between tokens of var x=1
*/
// CHECK#1
eval("\u000Cvar\u000Cx\u000C=\u000C1\u000C");
if (x !== 1) {
$ERROR('#1: eval("\\u000Cvar\\u000Cx\\u000C=\\u000C1\\u000C"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u000C" + "var" + "\u000C" + "x" + "\u000C" + "=" + "\u000C" + "1" + "\u000C");
if (x !== 1) {
$ERROR('#2: eval("\\u000C" + "var" + "\\u000C" + "x" + "\\u000C" + "=" + "\\u000C" + "1" + "\\u000C"); x === 1. Actual: ' + (x));
}
//CHECK#3
eval("\fvar\fx\f=\f1\f");
if (x !== 1) {
$ERROR('#3: eval("\\fvar\\fx\\f=\\f1\\f"); x === 1. Actual: ' + (x));
}
//CHECK#4
eval("\f" + "var" + "\f" + "x" + "\f" + "=" + "\f" + "1" + "\f");
if (x !== 1) {
$ERROR('#4: eval("\\f" + "var" + "\\f" + "x" + "\\f" + "=" + "\\f" + "1" + "\\f"); x === 1. Actual: ' + (x));
}
//CHECK#5
eval("\u000C" + "var" + "\f" + "x" + "\u000C" + "=" + "\f" + "1" + "\u000C");
if (x !== 1) {
$ERROR('#5: eval("\\u000C" + "var" + "\\f" + "x" + "\\u000C" + "=" + "\\f" + "1" + "\\u000C"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* FORM FEED (U+000C) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.3_T2.js
* @description Insert real FORM FEED between tokens of var x=1
*/
//CHECK#1
var x = 1 ;
if (x !== 1) {
$ERROR('#1: var x = 1 ; x === 1. Actual: ' + (x));
}
//CHECK#2
eval(" var\fx =\f1 ");
if (x !== 1) {
$ERROR('#2: var\\fx =\\f1 ; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* SPACE (U+0020) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.4_T1.js
* @description Insert SPACE(\u0020) between tokens of var x=1
*/
// CHECK#1
eval("\u0020var\u0020x\u0020=\u00201\u0020");
if (x !== 1) {
$ERROR('#1: eval("\\u0020var\\u0020x\\u0020=\\u00201\\u0020"); x === 1;');
}
//CHECK#2
eval("\u0020" + "var" + "\u0020" + "x" + "\u0020" + "=" + "\u0020" + "1" + "\u0020");
if (x !== 1) {
$ERROR('#2: eval("\\u0020" + "var" + "\\u0020" + "x" + "\\u0020" + "=" + "\\u0020" + "1" + "\\u0020"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* SPACE (U+0020) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.4_T2.js
* @description Insert real SPACE between tokens of var x=1
*/
//CHECK#1
eval("\u0020var x\u0020= 1\u0020");
if (x !== 1) {
$ERROR('#1: eval("\\u0020var x\\u0020= 1\\u0020"); x === 1. Actual: ' + (x));
}
//CHECK#2
var x = 1 ;
if (x !== 1) {
$ERROR('#2: var x = 1 ; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* NO-BREAK SPACE (U+00A0) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.5_T1.js
* @description Insert NO-BREAK SPACE(\u00A0) between tokens of var x=1
*/
// CHECK#1
eval("\u00A0var\u00A0x\u00A0=\u00A01\u00A0");
if (x !== 1) {
$ERROR('#1: eval("\\u00A0var\\u00A0x\\u00A0=\\u00A01\\u00A0"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u00A0" + "var" + "\u00A0" + "x" + "\u00A0" + "=" + "\u00A0" + "1" + "\u00A0");
if (x !== 1) {
$ERROR('#2: eval("\\u00A0" + "var" + "\\u00A0" + "x" + "\\u00A0" + "=" + "\\u00A0" + "1" + "\\u00A0"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* NO-BREAK SPACE (U+00A0) between any two tokens is allowed
*
* @section 7.2, 7.5
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A1.5_T2.js
* @description Insert real NO-BREAK SPACE between tokens of var x=1
*/
//CHECK#1
eval("\u00A0var x\u00A0= 1\u00A0");
if (x !== 1) {
$ERROR('#1: eval("\\u00A0var x\\u00A0= 1\\u00A0"); x === 1. Actual: ' + (x));
}
//CHECK#2
 var x = 1 ;
if (x !== 1) {
$ERROR('#2:  var x = 1 ; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* HORIZONTAL TAB (U+0009) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.1_T1.js
* @description Use HORIZONTAL TAB(\u0009 and \t)
*/
// CHECK#1
if (eval("'\u0009str\u0009ing\u0009'") !== "\u0009str\u0009ing\u0009") {
$ERROR('#1: eval("\'\\u0009str\\u0009ing\\u0009\'") === "\\u0009str\\u0009ing\\u0009"');
}
//CHECK#2
if (eval("'\tstr\ting\t'") !== "\tstr\ting\t") {
$ERROR('#2: eval("\'\\tstr\\ting\\t\'") === "\\tstr\\ting\\t"');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* HORIZONTAL TAB (U+0009) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.1_T2.js
* @description Use real HORIZONTAL TAB
*/
//CHECK#1
if (" str ing " !== "\u0009str\u0009ing\u0009") {
$ERROR('#1: " str ing " === "\\u0009str\\u0009ing\\u0009"');
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* VERTICAL TAB (U+000B) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.2_T1.js
* @description Use VERTICAL TAB(\u000B and \v)
*/
// CHECK#1
if (eval("'\u000Bstr\u000Bing\u000B'") !== "\u000Bstr\u000Bing\u000B") {
$ERROR('#1: eval("\'\\u000Bstr\\u000Bing\\u000B\'") === "\\u000Bstr\\u000Bing\\u000B"');
}
//CHECK#2
if (eval("'\vstr\ving\v'") !== "\vstr\ving\v") {
$ERROR('#2: eval("\'\\vstr\\ving\\v\'") === "\\vstr\\ving\\v"');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* VERTICAL TAB (U+000B) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.2_T2.js
* @description Use real VERTICAL TAB
*/
//CHECK#1
if (" str ing " !== "\u000Bstr\u000Bing\u000B") {
$ERROR('#1: " str ing " === "\\u000Bstr\\u000Bing\\u000B"');
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* FORM FEED (U+000C) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.3_T1.js
* @description Use FORM FEED(\u000C and \f)
*/
// CHECK#1
if (eval("'\u000Cstr\u000Cing\u000C'") !== "\u000Cstr\u000Cing\u000C") {
$ERROR('#1: eval("\'\\u000Cstr\\u000Cing\\u000C\'") === "\\u000Cstr\\u000Cing\\u000C"');
}
//CHECK#2
if (eval("'\fstr\fing\f'") !== "\fstr\fing\f") {
$ERROR('#2: eval("\'\\fstr\\fing\\f\'") === "\\fstr\\fing\\f"');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* FORM FEED (U+000C) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.3_T2.js
* @description Use real FORM FEED
*/
//CHECK#1
if (" str ing " !== "\u000Cstr\u000Cing\u000C") {
$ERROR('#1: " str ing " === "\\u000Cstr\\u000Cing\\u000C"');
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* SPACE (U+0020) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.4_T1.js
* @description Use SPACE(\u0020)
*/
// CHECK#1
if (eval("'\u0020str\u0020ing\u0020'") !== "\u0020str\u0020ing\u0020") {
$ERROR('#1: eval("\'\\u0020str\\u0020ing\\u0020\'") === "\\u0020str\\u0020ing\\u0020"');
}
//CHECK#2
if (eval("' str ing '") !== " str ing ") {
$ERROR('#2: eval("\' str ing \'") === " str ing "');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* SPACE (U+0020) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.4_T2.js
* @description Use real SPACE
*/
//CHECK#1
if (" str ing " !== "\u0020str\u0020ing\u0020") {
$ERROR('#1: " str ing " === "\\u0020str\\u0020ing\\u0020"');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* NO-BREAK SPACE (U+00A0) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.5_T1.js
* @description Use NO-BREAK SPACE(\u00A0)
*/
// CHECK#1
if (eval("'\u00A0str\u00A0ing\u00A0'") !== "\u00A0str\u00A0ing\u00A0") {
$ERROR('#1: eval("\'\\u00A0str\\u00A0ing\\u00A0\'") === "\\u00A0str\\u00A0ing\\u00A0"');
}

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* NO-BREAK SPACE (U+00A0) may occur within strings
*
* @section 7.2, 7.8.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A2.5_T2.js
* @description Use real NO-BREAK SPACE
*/
//CHECK#1
if (" str ing " !== "\u00A0str\u00A0ing\u00A0") {
$ERROR('#1: " str ing " === "\\u00A0str\\u00A0ing\\u00A0"');
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain HORIZONTAL TAB (U+0009)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.1_T1.js
* @description Use HORIZONTAL TAB(\u0009)
*/
// CHECK#1
eval("//\u0009 single line \u0009 comment \u0009");
//CHECK#2
var x = 0;
eval("//\u0009 single line \u0009 comment \u0009 x = 1;");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("//\\u0009 single line \\u0009 comment \\u0009 x = 1;"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain HORIZONTAL TAB (U+0009)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.1_T2.js
* @description Use real HORIZONTAL TAB
*/
//CHECK#1
var x = 0;
// single line comment x = 1;
if (x !== 0) {
$ERROR('#1: var x = 0; // single line comment x = 1; x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain VERTICAL TAB (U+000B)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.2_T1.js
* @description Use VERTICAL TAB(\u000B)
*/
// CHECK#1
eval("//\u000B single line \u000B comment \u000B");
//CHECK#2
var x = 0;
eval("//\u000B single line \u000B comment \u000B x = 1;");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("//\\u000B single line \\u000B comment \\u000B x = 1;"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain VERTICAL TAB (U+000B)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.2_T2.js
* @description Use real VERTICAL TAB
*/
//CHECK#1
var x = 0;
// single line comment x = 1;
if (x !== 0) {
$ERROR('#1: var x = 0; // single line comment x = 1; x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain FORM FEED (U+000C)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.3_T1.js
* @description Use FORM FEED(\u000C)
*/
// CHECK#1
eval("//\u000C single line \u000C comment \u000C");
//CHECK#2
var x = 0;
eval("//\u000C single line \u000C comment \u000C x = 1;");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("//\\u000C single line \\u000C comment \\u000C x = 1;"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain FORM FEED (U+000C)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.3_T2.js
* @description Use real FORM FEED
*/
//CHECK#1
var x = 0;
// single line comment x = 1;
if (x !== 0) {
$ERROR('#1: var x = 0; // single line comment x = 1; x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain SPACE (U+0020)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.4_T1.js
* @description Use SPACE(\u0020)
*/
// CHECK#1
eval("//\u0020 single line \u0020 comment \u0020");
//CHECK#2
var x = 0;
eval("//\u0020 single line \u0020 comment \u0020 x = 1;");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("//\\u0020 single line \\u0020 comment \\u0020 x = 1;"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain SPACE (U+0020)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.4_T2.js
* @description Use real SPACE
*/
//CHECK#1
var x = 0;
// single line comment x = 1;
if (x !== 0) {
$ERROR('#1: var x = 0; // single line comment x = 1; x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain NO-BREAK SPACE (U+00A0)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.5_T1.js
* @description Use NO-BREAK SPACE(\u00A0)
*/
// CHECK#1
eval("//\u00A0 single line \u00A0 comment \u00A0");
//CHECK#2
var x = 0;
eval("//\u00A0 single line \u00A0 comment \u00A0 x = 1;");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("//\\u00A0 single line \\u00A0 comment \\u00A0 x = 1;"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comment can contain NO-BREAK SPACE (U+00A0)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A3.5_T2.js
* @description Use real NO-BREAK SPACE
*/
//CHECK#1
var x = 0;
// single line comment x = 1;
if (x !== 0) {
$ERROR('#1: var x = 0; // single line comment x = 1; x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain HORIZONTAL TAB (U+0009)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.1_T1.js
* @description Use HORIZONTAL TAB(\u0009)
*/
// CHECK#1
eval("/*\u0009 multi line \u0009 comment \u0009*/");
//CHECK#2
var x = 0;
eval("/*\u0009 multi line \u0009 comment \u0009 x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u0009 multi line \\u0009 comment \\u0009 x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain HORIZONTAL TAB (U+0009)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.1_T2.js
* @description Use real HORIZONTAL TAB
*/
/*CHECK#1*/
var x = 0;
/* multi line comment x = 1;*/
if (x !== 0) {
$ERROR('#1: var x = 0; /* multi line comment x = 1;*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain VERTICAL TAB (U+000B)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.2_T1.js
* @description Use VERTICAL TAB(\u000B)
*/
// CHECK#1
eval("/*\u000B multi line \u000B comment \u000B*/");
//CHECK#2
var x = 0;
eval("/*\u000B multi line \u000B comment \u000B x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u000B multi line \\u000B comment \\u000B x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain VERTICAL TAB (U+000B)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.2_T2.js
* @description Use real VERTICAL TAB
*/
/*CHECK#1*/
var x = 0;
/* multi line comment x = 1;*/
if (x !== 0) {
$ERROR('#1: var x = 0; /* multi line comment x = 1;*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain FORM FEED (U+000C)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.3_T1.js
* @description Use FORM FEED(\u000C)
*/
// CHECK#1
eval("/*\u000C multi line \u000C comment \u000C*/");
//CHECK#2
var x = 0;
eval("/*\u000C multi line \u000C comment \u000C x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u000C multi line \\u000C comment \\u000C x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain FORM FEED (U+000C)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.3_T2.js
* @description Use real FORM FEED
*/
/*CHECK#1*/
var x = 0;
/* multi line comment x = 1;*/
if (x !== 0) {
$ERROR('#1: var x = 0; /* multi line comment x = 1;*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain SPACE (U+0020)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.4_T1.js
* @description Use SPACE(\u0020)
*/
// CHECK#1
eval("/*\u0020 multi line \u0020 comment \u0020*/");
//CHECK#2
var x = 0;
eval("/*\u0020 multi line \u0020 comment \u0020 x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u0020 multi line \\u0020 comment \\u0020 x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain SPACE (U+0020)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.4_T2.js
* @description Use real SPACE
*/
/*CHECK#1*/
var x = 0;
/* multi line comment x = 1;*/
if (x !== 0) {
$ERROR('#1: var x = 0; /* multi line comment x = 1;*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain NO-BREAK SPACE (U+00A0)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.5_T1.js
* @description Use NO-BREAK SPACE(\u00A0)
*/
// CHECK#1
eval("/*\u00A0 multi line \u00A0 comment \u00A0*/");
//CHECK#2
var x = 0;
eval("/*\u00A0 multi line \u00A0 comment \u00A0 x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u00A0 multi line \\u00A0 comment \\u00A0 x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain NO-BREAK SPACE (U+00A0)
*
* @section 7.2, 7.4
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A4.5_T2.js
* @description Use real NO-BREAK SPACE
*/
/*CHECK#1*/
var x = 0;
/* multi line comment x = 1;*/
if (x !== 0) {
$ERROR('#1: var x = 0; /* multi line comment x = 1;*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.2
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T1.js
* @description Use TAB (U+0009)
* @negative
*/
var\u0009x;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.2
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T2.js
* @description Use VERTICAL TAB (U+000B)
* @negative
*/
var\u000Bx;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.2
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T3.js
* @description Use FORM FEED (U+000C)
* @negative
*/
var\u000Cx;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.2
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T4.js
* @description Use SPACE (U+0020)
* @negative
*/
var\u0020x;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* White space cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.2
* @path 07_Lexical_Conventions/7.2_White_Space/S7.2_A5_T5.js
* @description Use NO-BREAK SPACE (U+00A0)
* @negative
*/
var\u00A0x;

View File

@ -0,0 +1,41 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE FEED (U+000A) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.1_T1.js
* @description Insert LINE FEED (\u000A and \n) between tokens of var x=1
*/
// CHECK#1
eval("\u000Avar\u000Ax\u000A=\u000A1\u000A");
if (x !== 1) {
$ERROR('#1: eval("\\u000Avar\\u000Ax\\u000A=\\u000A1\\u000A"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u000A" + "var" + "\u000A" + "x" + "\u000A" + "=" + "\u000A" + "1" + "\u000A");
if (x !== 1) {
$ERROR('#2: eval("\\u000A" + "var" + "\\u000A" + "x" + "\\u000A" + "=" + "\\u000A" + "1" + "\\u000A"); x === 1. Actual: ' + (x));
}
//CHECK#3
eval("\nvar\nx\n=\n1\n");
if (x !== 1) {
$ERROR('#3: eval("\\nvar\\nx\\n=\\n1\\n"); x === 1. Actual: ' + (x));
}
//CHECK#4
eval("\n" + "var" + "\n" + "x" + "\n" + "=" + "\n" + "1" + "\n");
if (x !== 1) {
$ERROR('#4: eval("\\n" + "var" + "\\n" + "x" + "\\n" + "=" + "\\n" + "1" + "\\n"); x === 1. Actual: ' + (x));
}
//CHECK#5
eval("\u000A" + "var" + "\n" + "x" + "\u000A" + "=" + "\n" + "1" + "\u000A");
if (x !== 1) {
$ERROR('#5: eval("\\u000A" + "var" + "\\n" + "x" + "\\u000A" + "=" + "\\n" + "1" + "\\u000A"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,20 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE FEED (U+000A) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.1_T2.js
* @description Insert real LINE FEED between tokens of var x=1
*/
//CHECK#1
var
x
=
1;
if (x !== 1) {
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,41 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* CARRIAGE RETURN (U+000D) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.2_T1.js
* @description Insert CARRIAGE RETURN (\u000D and \r) between tokens of var x=1
*/
// CHECK#1
eval("\u000Dvar\u000Dx\u000D=\u000D1\u000D");
if (x !== 1) {
$ERROR('#1: eval("\\u000Dvar\\u000Dx\\u000D=\\u000D1\\u000D"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u000D" + "var" + "\u000D" + "x" + "\u000D" + "=" + "\u000D" + "1" + "\u000D");
if (x !== 1) {
$ERROR('#2: eval("\\u000D" + "var" + "\\u000D" + "x" + "\\u000D" + "=" + "\\u000D" + "1" + "\\u000D"); x === 1. Actual: ' + (x));
}
//CHECK#3
eval("\rvar\rx\r=\r1\r");
if (x !== 1) {
$ERROR('#3: eval("\\rvar\\rx\\r=\\r1\\r"); x === 1. Actual: ' + (x));
}
//CHECK#4
eval("\r" + "var" + "\r" + "x" + "\r" + "=" + "\r" + "1" + "\r");
if (x !== 1) {
$ERROR('#4: eval("\\r" + "var" + "\\r" + "x" + "\\r" + "=" + "\\r" + "1" + "\\r"); x === 1. Actual: ' + (x));
}
//CHECK#5
eval("\u000D" + "var" + "\r" + "x" + "\u000D" + "=" + "\r" + "1" + "\u000D");
if (x !== 1) {
$ERROR('#5: eval("\\u000D" + "var" + "\\r" + "x" + "\\u000D" + "=" + "\\r" + "1" + "\\u000D"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,20 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* CARRIAGE RETURN (U+000D) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.2_T2.js
* @description Insert real CARRIAGE RETURN between tokens of var x=1
*/
//CHECK#1
var
x
=
1;
if (x !== 1) {
$ERROR('#1: var\\nx\\n=\\n1\\n; x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,24 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE SEPARATOR (U+2028) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.3.js
* @description Insert LINE SEPARATOR (\u2028) between tokens of var x=1
*/
// CHECK#1
eval("\u2028var\u2028x\u2028=\u20281\u2028");
if (x !== 1) {
$ERROR('#1: eval("\\u2028var\\u2028x\\u2028=\\u20281\\u2028"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u2028" + "var" + "\u2028" + "x" + "\u2028" + "=" + "\u2028" + "1" + "\u2028");
if (x !== 1) {
$ERROR('#2: eval("\\u2028" + "var" + "\\u2028" + "x" + "\\u2028" + "=" + "\\u2028" + "1" + "\\u2028"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,26 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* PARAGRAPH SEPARATOR (U+2029) may occur between any two tokens
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A1.4.js
* @description Insert PARAGRAPH SEPARATOR (\u2029) between tokens of var x=1
*/
// CHECK#1
eval("\u2029var\u2029x\u2029=\u20291\u2029");
if (x !== 1) {
$ERROR('#1: eval("\\u2029var\\u2029x\\u2029=\\u20291\\u2029"); x === 1. Actual: ' + (x));
}
//CHECK#2
eval("\u2029" + "var" + "\u2029" + "x" + "\u2029" + "=" + "\u2029" + "1" + "\u2029");
if (x !== 1) {
$ERROR('#2: eval("\\u2029" + "var" + "\\u2029" + "x" + "\\u2029" + "=" + "\\u2029" + "1" + "\\u2029"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE FEED (U+000A) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T1.js
* @description Insert LINE FEED (\u000A) into string
* @negative
*/
// CHECK#1
if (eval("'\u000Astr\u000Aing\u000A'") === "\u000Astr\u000Aing\u000A") {
$ERROR('#1: eval("\'\\u000Astr\\u000Aing\\u000A\'") === "\\u000Astr\\u000Aing\\u000A"');
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE FEED (U+000A) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.1_T2.js
* @description Use real LINE FEED into string
* @negative
*/
//CHECK#1
"
str
ing
";

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* CARRIAGE RETURN (U+000D) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T1.js
* @description Insert CARRIAGE RETURN (\u000D) into string
* @negative
*/
// CHECK#1
if (eval("'\u000Dstr\u000Ding\u000D'") === "\u000Dstr\u000Ding\u000D") {
$ERROR('#1: eval("\'\\u000Dstr\\u000Ding\\u000D\'") === "\\u000Dstr\\u000Ding\\u000D"');
}

View File

@ -0,0 +1,18 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* CARRIAGE RETURN (U+000D) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.2_T2.js
* @description Insert real CARRIAGE RETURN into string
* @negative
*/
//CHECK#1
"
str
ing
";

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* LINE SEPARATOR (U+2028) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.3.js
* @description Insert LINE SEPARATOR (\u2028) into string
* @negative
*/
// CHECK#1
if (eval("'\u2028str\u2028ing\u2028'") === "\u2028str\u2028ing\u2028") {
$ERROR('#1: eval("\'\\u2028str\\u2028ing\\u2028\'") === "\\u2028str\\u2028ing\\u2028"');
}

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* PARAGRAPH SEPARATOR (U+2029) within strings is not allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A2.4.js
* @description Insert PARAGRAPH SEPARATOR (\u2029) into string
* @negative
*/
// CHECK#1
if (eval("'\u2029str\u2029ing\u2029'") === "\u2029str\u2029ing\u2029") {
$ERROR('#1: eval("\'\\u2029str\\u2029ing\\u2029\'") === "\\u2029str\\u2029ing\\u2029"');
}

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain LINE FEED (U+000A) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.1_T1.js
* @description Insert LINE FEED (\u000A) into single line comment
* @negative
*/
// CHECK#1
eval("// single line \u000A comment");

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain LINE FEED (U+000A) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.1_T2.js
* @description Insert LINE FEED (\u000A) into begin of single line comment
* @negative
*/
// CHECK#1
eval("//\u000A single line comment");

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain LINE FEED (U+000A) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.1_T3.js
* @description Insert real LINE FEED into single line comment
* @negative
*/
// CHECK#1
//single
line comment

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain CARRIAGE RETURN (U+000D) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.2_T1.js
* @description Insert CARRIAGE RETURN (\u000D) into single line comment
* @negative
*/
// CHECK#1
eval("// single line \u000D comment");

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain CARRIAGE RETURN (U+000D) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.2_T2.js
* @description Insert CARRIAGE RETURN (\u000D) into begin of single line comment
* @negative
*/
// CHECK#1
eval("//\u000D single line comment");

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain CARRIAGE RETURN (U+000D) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.2_T3.js
* @description Insert real CARRIAGE RETURN into single line comment
* @negative
*/
// CHECK#1
//single
line comment

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain LINE SEPARATOR (U+2028) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.3_T1.js
* @description Insert LINE SEPARATOR (\u2028) into single line comment
* @negative
*/
// CHECK#1
eval("// single line \u2028 comment");

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain LINE SEPARATOR (U+2028) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.3_T2.js
* @description Insert LINE SEPARATOR (\u2028) into begin of single line comment
* @negative
*/
// CHECK#1
eval("//\u2028 single line comment");

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain PARAGRAPH SEPARATOR (U+2029) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.4_T1.js
* @description Insert PARAGRAPH SEPARATOR (\u2029) into single line comment
* @negative
*/
// CHECK#1
eval("// single line \u2029 comment");

View File

@ -0,0 +1,15 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can not contain PARAGRAPH SEPARATOR (U+2029) inside
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A3.4_T2.js
* @description Insert PARAGRAPH SEPARATOR (\u2029) into begin of single line comment
* @negative
*/
// CHECK#1
eval("//\u2029 single line comment");

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can contain Line Terminator at the end of line
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A4_T1.js
* @description Insert LINE FEED (U+000A) into the end of single line comment
*/
// CHECK#1
eval("// single line comment\u000A");
// CHECK#2
var x = 0;
eval("// single line comment\u000A x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u000A x = 1;"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can contain Line Terminator at the end of line
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A4_T2.js
* @description Insert CARRIAGE RETURN (U+000D) into the end of single line comment
*/
// CHECK#1
eval("// single line comment\u000D");
// CHECK#2
var x = 0;
eval("// single line comment\u000D x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u000D x = 1;"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can contain Line Terminator at the end of line
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A4_T3.js
* @description Insert LINE SEPARATOR (U+2028) into the end of single line comment
*/
// CHECK#1
eval("// single line comment\u2028");
// CHECK#2
var x = 0;
eval("// single line comment\u2028 x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u2028 x = 1;"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Single line comments can contain Line Terminator at the end of line
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A4_T4.js
* @description Insert PARAGRAPH SEPARATOR (U+2029) into the end of single line comment
*/
// CHECK#1
eval("// single line comment\u2029");
// CHECK#2
var x = 0;
eval("// single line comment\u2029 x = 1;");
if (x !== 1) {
$ERROR('#1: var x = 0; eval("// single line comment\\u2029 x = 1;"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain LINE FEED (U+000A)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.1_T1.js
* @description Insert LINE FEED (U+000A) into multi line comment
*/
// CHECK#1
eval("/*\u000A multi line \u000A comment \u000A*/");
//CHECK#2
var x = 0;
eval("/*\u000A multi line \u000A comment \u000A x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u000A multi line \\u000A comment \\u000A x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain LINE FEED (U+000A)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.1_T2.js
* @description Insert real LINE FEED into multi line comment
*/
/*CHECK#1*/
var x = 0;
/*
multi
line
comment
x = 1;
*/
if (x !== 0) {
$ERROR('#1: var x = 0; /*\\nmulti\\nline\\ncomment\\nx = 1;\\n*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain CARRIAGE RETURN (U+000D)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.2_T1.js
* @description Insert CARRIAGE RETURN (U+000D) into multi line comment
*/
// CHECK#1
eval("/*\u000D multi line \u000D comment \u000D*/");
//CHECK#2
var x = 0;
eval("/*\u000D multi line \u000D comment \u000D x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u000D multi line \\u000D comment \\u000D x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,23 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain CARRIAGE RETURN (U+000D)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.2_T2.js
* @description Insert real CARRIAGE RETURN into multi line comment
*/
/*CHECK#1*/
var x = 0;
/*
multi
line
comment
x = 1;
*/
if (x !== 0) {
$ERROR('#1: var x = 0; /*\\rmulti\\rline\\rcomment\\rx = 1;\\r*/ x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain LINE SEPARATOR (U+2028)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.3.js
* @description Insert LINE SEPARATOR (U+2028) into multi line comment
*/
// CHECK#1
eval("/*\u2028 multi line \u2028 comment \u2028*/");
//CHECK#2
var x = 0;
eval("/*\u2028 multi line \u2028 comment \u2028 x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u2028 multi line \\u2028 comment \\u2028 x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comment can contain LINE SEPARATOR (U+2029)
*
* @section 7.3, 7.4
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A5.4.js
* @description Insert PARAGRAPH SEPARATOR (U+2029) into multi line comment
*/
// CHECK#1
eval("/*\u2029 multi line \u2029 comment \u2029*/");
//CHECK#2
var x = 0;
eval("/*\u2029 multi line \u2029 comment \u2029 x = 1;*/");
if (x !== 0) {
$ERROR('#1: var x = 0; eval("/*\\u2029 multi line \\u2029 comment \\u2029 x = 1;*/"); x === 0. Actual: ' + (x));
}

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminator cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A6_T1.js
* @description Insert LINE FEED (U+000A) in var x
* @negative
*/
var\u000Ax;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminator cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A6_T2.js
* @description Insert CARRIAGE RETURN (U+000D) in var x
* @negative
*/
var\u000Dx;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminator cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A6_T3.js
* @description Insert LINE SEPARATOR (U+2028) in var x
* @negative
*/
var\u2028x;

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminator cannot be expressed as a Unicode escape sequence consisting of six characters, namely \u plus four hexadecimal digits
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A6_T4.js
* @description Insert PARAGRAPH SEPARATOR (U+2029) in var x
* @negative
*/
var\u2029x;

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T1.js
* @description Insert Line Terminator in var x=y+z
*/
// CHECK#1
var y=2;
var z=3;
var
x
=
y
+
z
;
if (x !== 5) {
$ERROR('#1: var\\nx\\n=\\ny\\n+\\nz\\n; x === 5. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=2;
var z=3;
var
x
=
y
+
z
;
if (x !== 5) {
$ERROR('#2: var\\nx\\n=\\ny\\n+\\nz\\n; x === 5. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=2;
var z=3;
eval("\u2028var\u2028x\u2028=\u2028y\u2028+\u2028z\u2028");
if (x !== 5) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028+\\u2028z\\u2028"); x === 5. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=2;
var z=3;
eval("\u2029var\u2029x\u2029=\u2029y\u2029+\u2029z\u2029");
if (x !== 5) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029+\\u2029z\\u2029"); x === 5. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T2.js
* @description Insert Line Terminator in var x=y-z
*/
// CHECK#1
var y=3;
var z=2;
var
x
=
y
-
z
;
if (x !== 1) {
$ERROR('#1: var\\nx\\n=\\ny\\n-\\nz\\n; x === 1. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=3;
var z=2;
var
x
=
y
-
z
;
if (x !== 1) {
$ERROR('#2: var\\nx\\n=\\ny\\n-\\nz\\n; x === 1. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=3;
var z=2;
eval("\u2028var\u2028x\u2028=\u2028y\u2028-\u2028z\u2028");
if (x !== 1) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028-\\u2028z\\u2028"); x === 1. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=3;
var z=2;
eval("\u2029var\u2029x\u2029=\u2029y\u2029-\u2029z\u2029");
if (x !== 1) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029-\\u2029z\\u2029"); x === 1. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T3.js
* @description Insert Line Terminator in var x=y*z
*/
// CHECK#1
var y=3;
var z=2;
var
x
=
y
*
z
;
if (x !== 6) {
$ERROR('#1: var\\nx\\n=\\ny\\n*\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=3;
var z=2;
var
x
=
y
*
z
;
if (x !== 6) {
$ERROR('#2: var\\nx\\n=\\ny\\n*\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=3;
var z=2;
eval("\u2028var\u2028x\u2028=\u2028y\u2028*\u2028z\u2028");
if (x !== 6) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028*\\u2028z\\u2028"); x === 6. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=3;
var z=2;
eval("\u2029var\u2029x\u2029=\u2029y\u2029*\u2029z\u2029");
if (x !== 6) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029*\\u2029z\\u2029"); x === 6. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T4.js
* @description Insert Line Terminator in var x=y/z
*/
// CHECK#1
var y=12;
var z=2;
var
x
=
y
/
z
;
if (x !== 6) {
$ERROR('#1: var\\nx\\n=\\ny\\n/\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=12;
var z=2;
var
x
=
y
/
z
;
if (x !== 6) {
$ERROR('#2: var\\nx\\n=\\ny\\n/\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=12;
var z=2;
eval("\u2028var\u2028x\u2028=\u2028y\u2028/\u2028z\u2028");
if (x !== 6) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028/\\u2028z\\u2028"); x === 6. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=12;
var z=2;
eval("\u2029var\u2029x\u2029=\u2029y\u2029/\u2029z\u2029");
if (x !== 6) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029/\\u2029z\\u2029"); x === 6. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T5.js
* @description Insert Line Terminator in var x=y%z
*/
// CHECK#1
var y=16;
var z=10;
var
x
=
y
%
z
;
if (x !== 6) {
$ERROR('#1: var\\nx\\n=\\ny\\n%\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=16;
var z=10;
var
x
=
y
%
z
;
if (x !== 6) {
$ERROR('#2: var\\nx\\n=\\ny\\n%\\nz\\n; x === 6. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=16;
var z=10;
eval("\u2028var\u2028x\u2028=\u2028y\u2028%\u2028z\u2028");
if (x !== 6) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028%\\u2028z\\u2028"); x === 6. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=16;
var z=10;
eval("\u2029var\u2029x\u2029=\u2029y\u2029%\u2029z\u2029");
if (x !== 6) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029%\\u2029z\\u2029"); x === 6. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T6.js
* @description Insert Line Terminator in var x=y>>z
*/
// CHECK#1
var y=16;
var z=3;
var
x
=
y
>>
z
;
if (x !== 2) {
$ERROR('#1: var\\nx\\n=\\ny\\n>>\\nz\\n; x === 2. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=16;
var z=3;
var
x
=
y
>>
z
;
if (x !== 2) {
$ERROR('#2: var\\nx\\n=\\ny\\n>>\\nz\\n; x === 2. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=16;
var z=3;
eval("\u2028var\u2028x\u2028=\u2028y\u2028>>\u2028z\u2028");
if (x !== 2) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028>>\\u2028z\\u2028"); x === 2. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=16;
var z=3;
eval("\u2029var\u2029x\u2029=\u2029y\u2029>>\u2029z\u2029");
if (x !== 2) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029>>\\u2029z\\u2029"); x === 2. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T7.js
* @description Insert Line Terminator in var x=y<<z
*/
// CHECK#1
var y=2;
var z=3;
var
x
=
y
<<
z
;
if (x !== 16) {
$ERROR('#1: var\\nx\\n=\\ny\\n<<\\nz\\n; x === 16. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=2;
var z=3;
var
x
=
y
<<
z
;
if (x !== 16) {
$ERROR('#2: var\\nx\\n=\\ny\\n<<\\nz\\n; x ===16 ');
}
x=0;
// CHECK#3
var y=2;
var z=3;
eval("\u2028var\u2028x\u2028=\u2028y\u2028<<\u2028z\u2028");
if (x !== 16) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028<<\\u2028z\\u2028"); x === 16. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=2;
var z=3;
eval("\u2029var\u2029x\u2029=\u2029y\u2029<<\u2029z\u2029");
if (x !== 16) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029<<\\u2029z\\u2029"); x === 16. Actual: ' + (x));
}

View File

@ -0,0 +1,58 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Line Terminators between operators are allowed
*
* @section 7.3
* @path 07_Lexical_Conventions/7.3_Line_Terminators/S7.3_A7_T8.js
* @description Insert Line Terminator in var x=y<z
*/
// CHECK#1
var y=2;
var z=3;
var
x
=
y
<
z
;
if (x !== true) {
$ERROR('#1: var\\nx\\n=\\ny\\n<\\nz\\n; x === true. Actual: ' + (x));
}
x=0;
// CHECK#2
var y=2;
var z=3;
var
x
=
y
<
z
;
if (x !== true) {
$ERROR('#2: var\\nx\\n=\\ny\\n<\\nz\\n; x === true. Actual: ' + (x));
}
x=0;
// CHECK#3
var y=2;
var z=3;
eval("\u2028var\u2028x\u2028=\u2028y\u2028<\u2028z\u2028");
if (x !== true) {
$ERROR('#3: eval("\\u2028var\\u2028x\\u2028=\\u2028y\\u2028<\\u2028z\\u2028"); x === true. Actual: ' + (x));
}
x=0;
// CHECK#4
var y=2;
var z=3;
eval("\u2029var\u2029x\u2029=\u2029y\u2029<\u2029z\u2029");
if (x !== true) {
$ERROR('#4: eval("\\u2029var\\u2029x\\u2029=\\u2029y\\u2029<\\u2029z\\u2029"); x === true. Actual: ' + (x));
}

View File

@ -0,0 +1,45 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Correct interpretation of single line comments
*
* @section 7.4
* @path 07_Lexical_Conventions/7.4_Comments/S7.4_A1_T1.js
* @description Create comments with any code
*/
//CHECK#1
// $ERROR('#1: Correct interpretation single line comments');
//CHECK#2
var x = 0;
// x = 1;
if (x !== 0) {
$ERROR('#2: var x = 0; // x = 1; x === 0. Actual: ' + (x));
}
//CHECK#3
var // y = 1;
y;
if (y !== undefined) {
$ERROR('#3: var // y = 1; \\n y; y === undefined. Actual: ' + (y));
}
//CHECK#4
//$ERROR('#4: Correct interpretation single line comments') //$ERROR('#4: Correct interpretation single line comments'); //
////CHECK#5
//var x = 1;
//if (x === 1) {
// $ERROR('#5: Correct interpretation single line comments');
//}
//CHECK#6
//var this.y = 1;
this.y++;
if (isNaN(y) !== true) {
$ERROR('#6: //var this.y = 1; \\n this.y++; y === Not-a-Number. Actual: ' + (y));
}

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Correct interpretation of single line comments
*
* @section 7.4
* @path 07_Lexical_Conventions/7.4_Comments/S7.4_A1_T2.js
* @description Simple test, create empty comment: ///
*/
//CHECK#1
///

View File

@ -0,0 +1,79 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Correct interpretation of multi line comments
*
* @section 7.4
* @path 07_Lexical_Conventions/7.4_Comments/S7.4_A2_T1.js
* @description Create comments with any code
*/
/*CHECK#1*/
/* $ERROR('#1: Correct interpretation multi line comments');
*/
/*CHECK#2*/
var x = 0;
/* x = 1;*/
if (x !== 0) {
$ERROR('#2: var x = 0; /* x = 1;*/ x === 0. Actual: ' + (x));
}
//CHECK#3
var /* y = 1;*/
y;
if (y !== undefined) {
$ERROR('#3: var /* y = 1; */ \\n y; y === undefined. Actual: ' + (y));
}
//CHECK#4
var /* y = 1;*/ y;
if (y !== undefined) {
$ERROR('#4: var /* y = 1; */ y; y === undefined. Actual: ' + (y));
}
/*CHECK#5*/
/*var x = 1;
if (x === 1) {
$ERROR('#5: Correct interpretation multi line comments');
}
*/
/*CHECK#6*/
/*var this.y = 1;*/
this.y++;
if (isNaN(y) !== true) {
$ERROR('#6: /*var this.y = 1;*/ \\n this.y++; y === Not-a-Number. Actual: ' + (y));
}
//CHECK#7
var string = "/*var y = 0*/" /* y = 1;*/
if (string !== "/*var y = 0*/") {
$ERROR('#7: var string = "/*var y = 0*/" /* y = 1;*/ string === "//var y = 0"');
}
//CHECK#8
var string = "/*var y = 0" /* y = 1;*/
if (string !== "/*var y = 0") {
$ERROR('#8: var string = "/*var y = 0" /* y = 1;*/ string === "//var y = 0"');
}
/*CHECK#9*/
/** $ERROR('#9: Correct interpretation multi line comments');
*/
/*CHECK#10*/
/* $ERROR('#10: Correct interpretation multi line comments');
**/
/*CHECK#11*/
/****** $ERROR('#11: Correct interpretation multi line comments');*********
***********
*
**********
**/

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Correct interpretation of multi line comments
*
* @section 7.4
* @path 07_Lexical_Conventions/7.4_Comments/S7.4_A2_T2.js
* @description Try use /*CHECK#1/. This is not closed multi line comment
* @negative
*/
/*CHECK#1/

View File

@ -0,0 +1,21 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Multi line comments cannot nest
*
* @section 7.4
* @path 07_Lexical_Conventions/7.4_Comments/S7.4_A3.js
* @description Try use nested comments
* @negative
*/
/*CHECK#1*/
/*
var
/* x */
= 1;
*/

Some files were not shown because too many files have changed in this diff Show More