OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * This test makes sure that the "skipping Dart2Js compilations if the output is | 6 * This test makes sure that the "skipping Dart2Js compilations if the output is |
7 * already up to date" feature does work as it should. | 7 * already up to date" feature does work as it should. |
8 * Therefore this test ensures that compilations are only skipped if the last | 8 * Therefore this test ensures that compilations are only skipped if the last |
9 * modified date of the output of a dart2js compilation is newer than | 9 * modified date of the output of a dart2js compilation is newer than |
10 * - the the dart application to compile (including it's dependencies) | 10 * - the the dart application to compile (including it's dependencies) |
11 * - the dart2js snapshot | 11 * - the dart2js snapshot |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return suite.TestUtils.absolutePath(new Path(tempDir.path) | 97 return suite.TestUtils.absolutePath(new Path(tempDir.path) |
98 .append('test_dart2js.snapshot')); | 98 .append('test_dart2js.snapshot')); |
99 } | 99 } |
100 | 100 |
101 void touchFile(File file) { | 101 void touchFile(File file) { |
102 _writeToFile(file, _readFile(file)); | 102 _writeToFile(file, _readFile(file)); |
103 } | 103 } |
104 | 104 |
105 void _writeToFile(File file, String content) { | 105 void _writeToFile(File file, String content) { |
106 if (content != null) { | 106 if (content != null) { |
107 var fd = new File(file.fullPathSync()).openSync(FileMode.WRITE); | 107 var fd = new File(file.fullPathSync()).openSync(mode: FileMode.WRITE); |
108 fd.writeStringSync(content); | 108 fd.writeStringSync(content); |
109 fd.closeSync(); | 109 fd.closeSync(); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 String _readFile(File file) { | 113 String _readFile(File file) { |
114 return file.readAsStringSync(); | 114 return file.readAsStringSync(); |
115 } | 115 } |
116 | 116 |
117 File _createFile(Path path) { | 117 File _createFile(Path path) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 cleanup(); | 240 cleanup(); |
241 throw error; | 241 throw error; |
242 }).then((_) { | 242 }).then((_) { |
243 cleanup(); | 243 cleanup(); |
244 }); | 244 }); |
245 } | 245 } |
246 // We need to wait some time to make sure that the files we 'touch' get a | 246 // We need to wait some time to make sure that the files we 'touch' get a |
247 // bigger timestamp than the old ones | 247 // bigger timestamp than the old ones |
248 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); | 248 new Timer(new Duration(seconds: 1), touchFilesAndRunTests); |
249 } | 249 } |
OLD | NEW |