tool/stats.dart - logging of loose matches
diff --git a/pkgs/markdown/tool/stats.dart b/pkgs/markdown/tool/stats.dart index f5598ee..54ebdc7 100644 --- a/pkgs/markdown/tool/stats.dart +++ b/pkgs/markdown/tool/stats.dart
@@ -27,7 +27,13 @@ help: 'Update stats files in $_currentDir', negatable: false) ..addFlag('verbose', - defaultsTo: false, help: 'verbose output', negatable: false) + defaultsTo: false, + help: 'Print details for failures and errors.', + negatable: false) + ..addFlag('verbose-loose', + defaultsTo: false, + help: 'Print details for "loose" matches.', + negatable: false) ..addOption('flavor', allowed: ['common_mark', 'gfm'], defaultsTo: 'common_mark') ..addFlag('help', defaultsTo: false, negatable: false); @@ -51,6 +57,7 @@ var specifiedSection = options['section'] as String; var raw = options['raw'] as bool; var verbose = options['verbose'] as bool; + var verboseLooseMatch = options['verbose-loose'] as bool; var updateFiles = options['update-files'] as bool; if (updateFiles && (raw || verbose || (specifiedSection != null))) { @@ -80,8 +87,8 @@ var nestedMap = scores.putIfAbsent( section, () => new SplayTreeMap<int, CompareLevel>()); - nestedMap[e.example] = - _compareResult(e, verbose, extensionSet: extensionSet); + nestedMap[e.example] = _compareResult(e, verbose, verboseLooseMatch, + extensionSet: extensionSet); } }); @@ -94,7 +101,8 @@ } } -CompareLevel _compareResult(CommonMarkTestCase expected, bool verboseFail, +CompareLevel _compareResult( + CommonMarkTestCase expected, bool verboseFail, bool verboseLooseMatch, {ExtensionSet extensionSet}) { String output; try { @@ -122,6 +130,10 @@ 'FAIL', expected, expectedParsed.outerHtml, actual.outerHtml); } + if (looseMatch && verboseLooseMatch) { + printVerboseFailure('LOOSE', expected, output, actual.outerHtml); + } + return looseMatch ? CompareLevel.loose : CompareLevel.fail; }