Index: tests/standalone/io/skipping_dart2js_compilations_test.dart |
diff --git a/tests/standalone/io/skipping_dart2js_compilations_test.dart b/tests/standalone/io/skipping_dart2js_compilations_test.dart |
index da24696afc61cee24c8c0cef1d9652e9777568fa..21b4baa2aee8a06e7862679d45ec0121f49d5aba 100644 |
--- a/tests/standalone/io/skipping_dart2js_compilations_test.dart |
+++ b/tests/standalone/io/skipping_dart2js_compilations_test.dart |
@@ -38,12 +38,13 @@ class FileUtils { |
File testDart; |
File testSnapshot; |
- FileUtils({bool createJs, |
- bool createJsDeps, |
- bool createDart, |
- bool createSnapshot}) { |
+ FileUtils( |
+ {bool createJs, |
+ bool createJsDeps, |
+ bool createDart, |
+ bool createSnapshot}) { |
tempDir = Directory.systemTemp |
- .createTempSync('dart_skipping_dart2js_compilations'); |
+ .createTempSync('dart_skipping_dart2js_compilations'); |
if (createJs) { |
testJs = _createFile(testJsFilePath); |
_writeToFile(testJs, "test.js content"); |
@@ -58,7 +59,8 @@ class FileUtils { |
} |
if (createJsDeps) { |
testJsDeps = _createFile(testJsDepsFilePath); |
- var path = suite.TestUtils.absolutePath(new Path(tempDir.path)) |
+ var path = suite.TestUtils |
+ .absolutePath(new Path(tempDir.path)) |
.append("test.dart"); |
_writeToFile(testJsDeps, "file://$path"); |
} |
@@ -80,28 +82,28 @@ class FileUtils { |
} |
Path get scriptOutputPath { |
- return suite.TestUtils.absolutePath(new Path(tempDir.path) |
- .append('created_if_command_did_run.txt')); |
+ return suite.TestUtils.absolutePath( |
+ new Path(tempDir.path).append('created_if_command_did_run.txt')); |
} |
Path get testDartFilePath { |
- return suite.TestUtils.absolutePath(new Path(tempDir.path) |
- .append('test.dart')); |
+ return suite.TestUtils |
+ .absolutePath(new Path(tempDir.path).append('test.dart')); |
} |
Path get testJsFilePath { |
- return suite.TestUtils.absolutePath(new Path(tempDir.path) |
- .append('test.js')); |
+ return suite.TestUtils |
+ .absolutePath(new Path(tempDir.path).append('test.js')); |
} |
Path get testJsDepsFilePath { |
- return suite.TestUtils.absolutePath(new Path(tempDir.path) |
- .append('test.js.deps')); |
+ return suite.TestUtils |
+ .absolutePath(new Path(tempDir.path).append('test.js.deps')); |
} |
Path get testSnapshotFilePath { |
- return suite.TestUtils.absolutePath(new Path(tempDir.path) |
- .append('test_dart2js.snapshot')); |
+ return suite.TestUtils |
+ .absolutePath(new Path(tempDir.path).append('test_dart2js.snapshot')); |
} |
void touchFile(File file) { |
@@ -111,7 +113,7 @@ class FileUtils { |
void _writeToFile(File file, String content) { |
if (content != null) { |
var fd = new File(file.resolveSymbolicLinksSync()) |
- .openSync(mode: FileMode.WRITE); |
+ .openSync(mode: FileMode.WRITE); |
fd.writeStringSync(content); |
fd.closeSync(); |
} |
@@ -140,11 +142,11 @@ class CommandCompletedHandler { |
Expect.isTrue(output.stderr.length == 0); |
if (_shouldHaveRun) { |
Expect.isTrue(output.stdout.length == 0); |
- Expect.isTrue(new File(fileUtils.scriptOutputPath.toNativePath()) |
- .existsSync()); |
+ Expect.isTrue( |
+ new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); |
} else { |
- Expect.isFalse(new File(fileUtils.scriptOutputPath.toNativePath()) |
- .existsSync()); |
+ Expect.isFalse( |
+ new File(fileUtils.scriptOutputPath.toNativePath()).existsSync()); |
} |
} |
} |
@@ -152,11 +154,11 @@ class CommandCompletedHandler { |
runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) { |
var config = new options.TestOptionsParser().parse(['--timeout', '2'])[0]; |
var createFileScript = Platform.script |
- .resolve('skipping_dart2js_compilations_helper.dart').toFilePath(); |
+ .resolve('skipping_dart2js_compilations_helper.dart') |
+ .toFilePath(); |
var executable = Platform.executable; |
var arguments = [createFileScript, fileUtils.scriptOutputPath.toNativePath()]; |
- var bootstrapDeps = [ |
- Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; |
+ var bootstrapDeps = [Uri.parse("file://${fileUtils.testSnapshotFilePath}")]; |
return runner.CommandBuilder.instance.getCompilationCommand( |
'dart2js', |
fileUtils.testJsFilePath.toNativePath(), |
@@ -170,34 +172,41 @@ void main() { |
// This script is in [sdk]/tests/standalone/io. |
suite.TestUtils.setDartDirUri(Platform.script.resolve('../../..')); |
- var fs_noTestJs = new FileUtils(createJs: false, |
- createJsDeps: true, |
- createDart: true, |
- createSnapshot: true); |
- var fs_noTestJsDeps = new FileUtils(createJs: true, |
- createJsDeps: false, |
- createDart: true, |
- createSnapshot: true); |
- var fs_noTestDart = new FileUtils(createJs: true, |
- createJsDeps: true, |
- createDart: false, |
- createSnapshot: true); |
- var fs_noTestSnapshot = new FileUtils(createJs: true, |
- createJsDeps: true, |
- createDart: true, |
- createSnapshot: false); |
- var fs_notUpToDate_snapshot = new FileUtils(createJs: true, |
- createJsDeps: true, |
- createDart: true, |
- createSnapshot: true); |
- var fs_notUpToDate_dart = new FileUtils(createJs: true, |
- createJsDeps: true, |
- createDart: true, |
- createSnapshot: true); |
- var fs_upToDate = new FileUtils(createJs: true, |
- createJsDeps: true, |
- createDart: true, |
- createSnapshot: true); |
+ var fs_noTestJs = new FileUtils( |
+ createJs: false, |
+ createJsDeps: true, |
+ createDart: true, |
+ createSnapshot: true); |
+ var fs_noTestJsDeps = new FileUtils( |
+ createJs: true, |
+ createJsDeps: false, |
+ createDart: true, |
+ createSnapshot: true); |
+ var fs_noTestDart = new FileUtils( |
+ createJs: true, |
+ createJsDeps: true, |
+ createDart: false, |
+ createSnapshot: true); |
+ var fs_noTestSnapshot = new FileUtils( |
+ createJs: true, |
+ createJsDeps: true, |
+ createDart: true, |
+ createSnapshot: false); |
+ var fs_notUpToDate_snapshot = new FileUtils( |
+ createJs: true, |
+ createJsDeps: true, |
+ createDart: true, |
+ createSnapshot: true); |
+ var fs_notUpToDate_dart = new FileUtils( |
+ createJs: true, |
+ createJsDeps: true, |
+ createDart: true, |
+ createSnapshot: true); |
+ var fs_upToDate = new FileUtils( |
+ createJs: true, |
+ createJsDeps: true, |
+ createDart: true, |
+ createSnapshot: true); |
void cleanup() { |
fs_noTestJs.cleanup(); |
fs_noTestJsDeps.cleanup(); |
@@ -221,6 +230,7 @@ void main() { |
completedHandler.processCompletedTest(output); |
}); |
} |
+ |
// We run the tests in sequence, so that if one of them failes we clean up |
// everything and throw. |
runTest("fs_noTestJs", fs_noTestJs, true).then((_) { |
@@ -245,6 +255,7 @@ void main() { |
cleanup(); |
}); |
} |
+ |
// We need to wait some time to make sure that the files we 'touch' get a |
// bigger timestamp than the old ones |
new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |