Skip to content

Commit

Permalink
Merge pull request #63 from keertip/test
Browse files Browse the repository at this point in the history
run dartdoc as a test
  • Loading branch information
keertip committed Jan 8, 2015
2 parents 5baf53b + 2c365b2 commit 4dbb14b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
36 changes: 36 additions & 0 deletions tool/grind.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) 2015, Google Inc. Please see the AUTHORS file for details.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

import 'dart:io';

import 'package:dartdoc/dartdoc.dart';
import 'package:grinder/grinder.dart';

final Directory DOC_DIR = new Directory(DEFAULT_OUTPUT_DIRECTORY);

void main([List<String> args]) {
task('init', defaultInit);
task('test', testDartdoc, ['init']);
startGrinder(args);
}

/**
* Run dartdoc and check that the docs are generated.
*/
void testDartdoc(GrinderContext context) {
if (DOC_DIR.existsSync()) DOC_DIR.deleteSync(recursive: true);

try {
context.log('running dartdoc');
runDartScript(context, 'bin/dartdoc.dart');

File indexHtml = joinFile(DOC_DIR, ['index.html']);
if(!indexHtml.existsSync()) context.fail('docs not generated');
File docFile = joinFile(DOC_DIR, ['dartdoc.html']);
if(!docFile.existsSync()) context.fail('docs not generated');

} catch (e) {
rethrow;
}
}
9 changes: 8 additions & 1 deletion tool/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ fi
# Display installed versions.
dart --version

# Globally install grinder.
pub global activate grinder
export PATH="$PATH":"~/.pub-cache/bin"

# Get our packages.
pub get

Expand All @@ -28,6 +32,9 @@ dartanalyzer --fatal-warnings \
bin/dartdoc.dart \
lib/dartdoc.dart \
test/all.dart

# Run dartdoc.
pub global run grinder test

# Run the tests.
dart test/all.dart
Expand All @@ -40,4 +47,4 @@ if [ "$REPO_TOKEN" ]; then
--retry 2 \
--exclude-test-files \
test/all.dart
fi
fi

0 comments on commit 4dbb14b

Please sign in to comment.