@@ -8,7 +8,7 @@ import 'dart:convert';
88import 'dart:io' ;
99import 'dart:mirrors' ;
1010
11- import 'package:path/path.dart' as p ;
11+ import 'package:path/path.dart' as path ;
1212import 'package:test/test.dart' ;
1313
1414const List <String > _filesToIgnore = const < String > ['.DS_Store' ];
@@ -21,16 +21,17 @@ Uri get _currentFileUri =>
2121 (reflect (main) as ClosureMirror ).function.location.sourceUri;
2222
2323String get _testPackageDocsPath =>
24- p .fromUri (_currentFileUri.resolve ('../testing/test_package_docs' ));
24+ path .fromUri (_currentFileUri.resolve ('../testing/test_package_docs' ));
2525
2626String get _testPackagePath =>
27- p .fromUri (_currentFileUri.resolve ('../testing/test_package' ));
27+ path .fromUri (_currentFileUri.resolve ('../testing/test_package' ));
2828
2929void main () {
3030 group ('compare outputs' , () {
3131 Directory tempDir;
3232
33- var dartdocBin = p.fromUri (_currentFileUri.resolve ('../bin/dartdoc.dart' ));
33+ var dartdocBin =
34+ path.fromUri (_currentFileUri.resolve ('../bin/dartdoc.dart' ));
3435
3536 setUp (() {
3637 tempDir = Directory .systemTemp.createTempSync ('dartdoc.test.' );
@@ -99,8 +100,8 @@ void main() {
99100 'diff' ,
100101 '--no-index' ,
101102 '--no-color' ,
102- p .join (_testPackageDocsPath, k),
103- p .join (tempDir.path, k)
103+ path .join (_testPackageDocsPath, k),
104+ path .join (tempDir.path, k)
104105 ];
105106 result = Process .runSync (gitBinName, args);
106107 assert (result.exitCode != 0 );
@@ -149,6 +150,34 @@ void main() {
149150 }
150151 });
151152
153+ test ('--footer-text includes text' , () {
154+ String footerTextPath =
155+ path.join (Directory .systemTemp.path, 'footer.txt' );
156+ new File (footerTextPath).writeAsStringSync (' footer text include ' );
157+
158+ var args = < String > [
159+ dartdocBin,
160+ '--footer-text=${footerTextPath }' ,
161+ '--include' ,
162+ 'ex' ,
163+ '--output' ,
164+ tempDir.path
165+ ];
166+
167+ var result = Process .runSync (Platform .resolvedExecutable, args,
168+ workingDirectory: _testPackagePath);
169+
170+ if (result.exitCode != 0 ) {
171+ print (result.exitCode);
172+ print (result.stdout);
173+ print (result.stderr);
174+ fail ('dartdoc failed' );
175+ }
176+
177+ File outFile = new File (path.join (tempDir.path, 'index.html' ));
178+ expect (outFile.readAsStringSync (), contains ('footer text include' ));
179+ });
180+
152181 test ('Check dartdoc generation with crossdart' , () {
153182 var args = < String > [
154183 dartdocBin,
@@ -177,23 +206,23 @@ Map<String, String> _parseOutput(
177206 Match match = _nameStatusLineRegexp.firstMatch (line);
178207
179208 var type = match[1 ];
180- var path = match[2 ];
209+ var p = match[2 ];
181210
182- if (_filesToIgnore.any ((i) => p .basename (path ) == i)) {
211+ if (_filesToIgnore.any ((i) => path .basename (p ) == i)) {
183212 continue ;
184213 }
185214
186215 if (type == 'A' ) {
187- expect (p .isWithin (tempPath, path ), isTrue,
188- reason: '`$path ` should be within $tempPath ' );
189- path = p .relative (path , from: tempPath);
216+ expect (path .isWithin (tempPath, p ), isTrue,
217+ reason: '`$p ` should be within $tempPath ' );
218+ p = path .relative (p , from: tempPath);
190219 } else {
191- expect (p .isWithin (sourcePath, path ), isTrue,
192- reason: '`$path ` should be within $sourcePath ' );
193- path = p .relative (path , from: sourcePath);
220+ expect (path .isWithin (sourcePath, p ), isTrue,
221+ reason: '`$p ` should be within $sourcePath ' );
222+ p = path .relative (p , from: sourcePath);
194223 }
195224
196- values[path ] = type;
225+ values[p ] = type;
197226 }
198227
199228 return values;
0 commit comments