mirror of https://github.com/tc39/test262.git
[generation] Improve file creation heuristic
In expecting "case directories" to contain a sub-directory named "default", the test generation tool is unable to generate tests for features where a directory named "default" is not appropriate. Modify the heuristic that identifies "case directories" to use a more fundamental aspect (i.e. the existence of at least one "case" file).
This commit is contained in:
parent
b0b41775e5
commit
613d33adbb
|
@ -12,15 +12,21 @@ from lib.test import Test
|
||||||
def print_error(*values):
|
def print_error(*values):
|
||||||
print('ERROR:', *values, file=sys.stderr)
|
print('ERROR:', *values, file=sys.stderr)
|
||||||
|
|
||||||
|
# When a directory contains at least one file with a `.case` extension, it
|
||||||
|
# should be interpreted as a "case directory"
|
||||||
|
def is_case_dir(location):
|
||||||
|
for file_name in os.listdir(location):
|
||||||
|
if file_name.lower().endswith('.case'):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def find_cases(location):
|
def find_cases(location):
|
||||||
# When a file is specified, return the file name and its containing
|
# When a file is specified, return the file name and its containing
|
||||||
# directory
|
# directory
|
||||||
if os.path.isfile(location):
|
if os.path.isfile(location):
|
||||||
return location, [os.path.dirname(location)]
|
return location, [os.path.dirname(location)]
|
||||||
|
|
||||||
# When a directory is specified, if that directory contains a sub-directory
|
if is_case_dir(location):
|
||||||
# names "default" interpret it as a "case directory"
|
|
||||||
if (os.path.isdir(os.path.join(location, 'default'))):
|
|
||||||
return None, [location]
|
return None, [location]
|
||||||
else:
|
else:
|
||||||
return None, map(
|
return None, map(
|
||||||
|
|
Loading…
Reference in New Issue