Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1834)

Side by Side Diff: test/mjsunit/testcfg.py

Issue 1146733002: Revert of Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/harmony/arrow-functions-this.js ('k') | test/mjsunit/this-dynamic-lookup.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 17 matching lines...) Expand all
28 import os 28 import os
29 import re 29 import re
30 30
31 from testrunner.local import testsuite 31 from testrunner.local import testsuite
32 from testrunner.objects import testcase 32 from testrunner.objects import testcase
33 33
34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") 35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") 36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
37 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE) 37 MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
38 NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE)
39 38
40 39
41 class MjsunitTestSuite(testsuite.TestSuite): 40 class MjsunitTestSuite(testsuite.TestSuite):
42 41
43 def __init__(self, name, root): 42 def __init__(self, name, root):
44 super(MjsunitTestSuite, self).__init__(name, root) 43 super(MjsunitTestSuite, self).__init__(name, root)
45 44
46 def ListTests(self, context): 45 def ListTests(self, context):
47 tests = [] 46 tests = []
48 for dirname, dirs, files in os.walk(self.root): 47 for dirname, dirs, files in os.walk(self.root):
(...skipping 24 matching lines...) Expand all
73 files_match = FILES_PATTERN.search(source, files_match.end()) 72 files_match = FILES_PATTERN.search(source, files_match.end())
74 else: 73 else:
75 break 74 break
76 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f)) 75 files = [ os.path.normpath(os.path.join(self.root, '..', '..', f))
77 for f in files_list ] 76 for f in files_list ]
78 testfilename = os.path.join(self.root, testcase.path + self.suffix()) 77 testfilename = os.path.join(self.root, testcase.path + self.suffix())
79 if SELF_SCRIPT_PATTERN.search(source): 78 if SELF_SCRIPT_PATTERN.search(source):
80 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] 79 env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")]
81 files = env + files 80 files = env + files
82 81
83 if not context.no_harness and not NO_HARNESS_PATTERN.search(source): 82 if not context.no_harness:
84 files.append(os.path.join(self.root, "mjsunit.js")) 83 files.append(os.path.join(self.root, "mjsunit.js"))
85 84
86 if MODULE_PATTERN.search(source): 85 if MODULE_PATTERN.search(source):
87 files.append("--module") 86 files.append("--module")
88 files.append(testfilename) 87 files.append(testfilename)
89 88
90 flags += files 89 flags += files
91 if context.isolates: 90 if context.isolates:
92 flags.append("--isolate") 91 flags.append("--isolate")
93 flags += files 92 flags += files
94 93
95 return testcase.flags + flags 94 return testcase.flags + flags
96 95
97 def GetSourceForTest(self, testcase): 96 def GetSourceForTest(self, testcase):
98 filename = os.path.join(self.root, testcase.path + self.suffix()) 97 filename = os.path.join(self.root, testcase.path + self.suffix())
99 with open(filename) as f: 98 with open(filename) as f:
100 return f.read() 99 return f.read()
101 100
102 101
103 def GetSuite(name, root): 102 def GetSuite(name, root):
104 return MjsunitTestSuite(name, root) 103 return MjsunitTestSuite(name, root)
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/arrow-functions-this.js ('k') | test/mjsunit/this-dynamic-lookup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698