Update spec test
diff --git a/test/mustache_spec_test.dart b/test/mustache_spec_test.dart
index bfdb9c3..c3d6fa6 100644
--- a/test/mustache_spec_test.dart
+++ b/test/mustache_spec_test.dart
@@ -4,8 +4,25 @@
import 'dart:json' as json;
var verbose = false;
+var testName = null;
main() {
+ var args = new Options().arguments;
+ if (!args.isEmpty) {
+ for (var arg in args) {
+ if (arg == '--verbose' || arg == '-v') {
+ verbose = true;
+ } else if (arg.startsWith('-')) {
+ print('Unknown argument: $arg');
+ print('Usage: dart test/mustache_spec_test.dart [--verbose] [test name]');
+ return;
+ } else {
+ testName = arg;
+ verbose = true;
+ }
+ }
+ }
+
var specs = new Directory('test/spec')
.listSync()
.where((f) => f is File && f.path.endsWith('.json'));
@@ -27,6 +44,9 @@
}
runTest(String name, String desc, Map data, String template, String expected) {
+ if (testName != null && name != testName)
+ return;
+
var output;
var exception;
try {
@@ -38,10 +58,14 @@
var result = passed ? 'Pass' : 'Fail';
print(' $result $name');
if (verbose && !passed) {
+ print(desc);
print(' Template: $template');
print(' Data: ${json.stringify(data)}');
print(' Expected: $expected');
+ print(' Output: $output');
if (exception != null) print(' Exception: $exception'); // TODO stack trace.
+ print('');
+ print('');
}
}