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

Side by Side Diff: tests/standalone/io/addlatexhash_test.dart

Issue 883793002: Make addlatexhash_test clean up its temp directories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make suggested changes Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 // testing ../../../tools/addlatexhash.dart 6 // testing ../../../tools/addlatexhash.dart
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import '../../../tools/addlatexhash.dart'; 10 import '../../../tools/addlatexhash.dart';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 oneTestSisp(sispIsDartBegin, "Begin", "whatever else ..", false); 52 oneTestSisp(sispIsDartBegin, "Begin", "whatever else ..", false);
53 oneTestSisp(sispIsDartEnd, "End", "\\end{dartCode}", true); 53 oneTestSisp(sispIsDartEnd, "End", "\\end{dartCode}", true);
54 oneTestSisp(sispIsDartEnd, "End", " \\end{dartCode}\t \n", true); 54 oneTestSisp(sispIsDartEnd, "End", " \\end{dartCode}\t \n", true);
55 oneTestSisp(sispIsDartEnd, "End", "whatever else ..", false); 55 oneTestSisp(sispIsDartEnd, "End", "whatever else ..", false);
56 } 56 }
57 57
58 // Check that the hash values of paragraphs in the specially prepared 58 // Check that the hash values of paragraphs in the specially prepared
59 // LaTeX source 'addlatexhash_test_src.tex' are identical in groups 59 // LaTeX source 'addlatexhash_test_src.tex' are identical in groups
60 // of eight (so we get 8 identical hash values, then another hash 60 // of eight (so we get 8 identical hash values, then another hash
61 // value 8 times, etc.) 61 // value 8 times, etc.)
62 testSameHash() { 62 testSameHash(String tmpDirPath) {
63 // set up temporary directory to hold output
64 final tmpDir = Directory.systemTemp.createTempSync("addlatexhash_test");
65 final tmpDirPath = tmpDir.path;
66
67 // file names/paths for file containing groups of 8 variants of a paragraph 63 // file names/paths for file containing groups of 8 variants of a paragraph
68 const par8timesName = "addlatexhash_test_src"; 64 const par8timesName = "addlatexhash_test_src";
69 const par8timesFileName = "$par8timesName.tex"; 65 const par8timesFileName = "$par8timesName.tex";
70 final par8timesDirPath = path.join(dartRootDir, "tests", "standalone", "io"); 66 final par8timesDirPath = path.join(dartRootDir, "tests", "standalone", "io");
71 final par8timesPath = path.join(par8timesDirPath, par8timesFileName); 67 final par8timesPath = path.join(par8timesDirPath, par8timesFileName);
72 final tmpPar8timesPath = path.join(tmpDirPath, par8timesFileName); 68 final tmpPar8timesPath = path.join(tmpDirPath, par8timesFileName);
73 69
74 // file names paths for output 70 // file names paths for output
75 final hashName = par8timesName + "-hash"; 71 final hashName = par8timesName + "-hash";
76 final hashFileName = "$hashName.tex"; 72 final hashFileName = "$hashName.tex";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } else { 109 } else {
114 sameCount++; 110 sameCount++;
115 } 111 }
116 } 112 }
117 } 113 }
118 114
119 // Check that the LaTeX source transformation done by addlatexhash.dart 115 // Check that the LaTeX source transformation done by addlatexhash.dart
120 // does not affect the generated output, as seen via dvi2tty and diff. 116 // does not affect the generated output, as seen via dvi2tty and diff.
121 // NB: Not part of normal testing (only local): latex and dvi2tty are 117 // NB: Not part of normal testing (only local): latex and dvi2tty are
122 // not installed in the standard test environment. 118 // not installed in the standard test environment.
123 testSameDVI() { 119 testSameDVI(String tmpDirPath) {
124 // set up /tmp directory to hold output
125 final tmpDir = Directory.systemTemp.createTempSync("addlatexhash_test");
126 final tmpDirPath = tmpDir.path;
127
128 // file names/paths for original spec 120 // file names/paths for original spec
129 const specName = "dartLangSpec"; 121 const specName = "dartLangSpec";
130 const specFileName = "$specName.tex"; 122 const specFileName = "$specName.tex";
131 final specDirPath = path.join(dartRootDir, "docs", "language"); 123 final specDirPath = path.join(dartRootDir, "docs", "language");
132 final specPath = path.join(specDirPath, specFileName); 124 final specPath = path.join(specDirPath, specFileName);
133 final tmpSpecPath = path.join(tmpDirPath, specFileName); 125 final tmpSpecPath = path.join(tmpDirPath, specFileName);
134 const specDviFileName = "$specName.dvi"; 126 const specDviFileName = "$specName.dvi";
135 final specDviPath = path.join(tmpDirPath, specDviFileName); 127 final specDviPath = path.join(tmpDirPath, specDviFileName);
136 128
137 // file names/paths for associated sty 129 // file names/paths for associated sty
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 checkAction(runLatex(specName, tmpDirPath), "LaTeX on spec failed"); 174 checkAction(runLatex(specName, tmpDirPath), "LaTeX on spec failed");
183 } 175 }
184 for (var i = 0; i < 5; i++) { 176 for (var i = 0; i < 5; i++) {
185 checkAction(runLatex(hashFileName, tmpDirPath), "LaTeX on output failed"); 177 checkAction(runLatex(hashFileName, tmpDirPath), "LaTeX on output failed");
186 } 178 }
187 if (chkDvi2tty(specDviPath, "spec") != chkDvi2tty(hashDviPath, "output")) { 179 if (chkDvi2tty(specDviPath, "spec") != chkDvi2tty(hashDviPath, "output")) {
188 throw "dvi2tty spec != dvitty output"; 180 throw "dvi2tty spec != dvitty output";
189 } 181 }
190 } 182 }
191 183
184 runWithTempDir(void test(String tempDir)) {
Bill Hesse 2015/01/28 13:41:34 Changed name of function to runWithTempDir. It is
185 final tempDir = Directory.systemTemp.createTempSync("addlatexhash_test");
186 try {
187 test(tempDir.path);
188 }
189 finally {
190 tempDir.delete(recursive: true);
191 }
192 }
193
194
192 main([args]) { 195 main([args]) {
193 testCutMatch(); 196 testCutMatch();
194 testSisp(); 197 testSisp();
195 testSameHash(); 198
199 runWithTempDir(testSameHash);
196 // latex and dvi2tty are not installed in the standard test environment 200 // latex and dvi2tty are not installed in the standard test environment
197 if (args.length > 0 && args[0] == "local") testSameDVI(); 201 if (args.length > 0 && args[0] == "local") {
202 runWithTempDir(testSameDVI);
203 }
198 } 204 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698