| Index: pkg/docgen/test/constant_argument_test.dart
|
| diff --git a/pkg/docgen/test/typedef_test.dart b/pkg/docgen/test/constant_argument_test.dart
|
| similarity index 51%
|
| copy from pkg/docgen/test/typedef_test.dart
|
| copy to pkg/docgen/test/constant_argument_test.dart
|
| index 9911f0852193d75afc4c54d23cc298ab5a67817f..ca735f4781e98c4faa69cfa0c537039fff092dfe 100644
|
| --- a/pkg/docgen/test/typedef_test.dart
|
| +++ b/pkg/docgen/test/constant_argument_test.dart
|
| @@ -20,7 +20,7 @@ void main() {
|
| scheduleTempDir();
|
| });
|
|
|
| - test('typedef gen', () {
|
| + test('argument default values', () {
|
| schedule(() {
|
| var codeDir = getMultiLibraryCodePath();
|
| expect(FileSystemEntity.isDirectorySync(codeDir), isTrue);
|
| @@ -28,7 +28,7 @@ void main() {
|
| });
|
|
|
| schedule(() {
|
| - var path = p.join(d.defaultRoot, 'docs', 'test_lib-bar.json');
|
| + var path = p.join(d.defaultRoot, 'docs', 'test_lib.json');
|
| var dartCoreJson = new File(path).readAsStringSync();
|
|
|
| var testLibBar = JSON.decode(dartCoreJson) as Map<String, dynamic>;
|
| @@ -36,30 +36,27 @@ void main() {
|
| //
|
| // Validate function doc references
|
| //
|
| - var generateFoo = testLibBar['functions']['methods']['generateFoo']
|
| + var functionDef =
|
| + testLibBar['functions']['methods']['positionalDefaultValues']
|
| as Map<String, dynamic>;
|
|
|
| - expect(generateFoo['comment'], '<p><a>test_lib-bar.generateFoo.input</a> '
|
| - 'is of type <a>test_lib-bar.C</a> returns an <a>test_lib.A</a>.</p>');
|
| + var params = functionDef['parameters'] as Map<String, dynamic>;
|
|
|
| - var classes = testLibBar['classes'] as Map<String, dynamic>;
|
| -
|
| - expect(classes, hasLength(3));
|
| -
|
| - expect(classes['class'], isList);
|
| - expect(classes['error'], isList);
|
| -
|
| - var typeDefs = classes['typedef'] as Map<String, dynamic>;
|
| - var comparator = typeDefs['AnATransformer'] as Map<String, dynamic>;
|
| -
|
| - var expectedPreview = '<p>Processes a [C] instance for testing.</p>';
|
| -
|
| - expect(comparator['preview'], expectedPreview);
|
| -
|
| - var expectedComment = expectedPreview + '\n'
|
| - '<p>To eliminate import warnings for [A] and to test typedefs.</p>';
|
| -
|
| - expect(comparator['comment'], expectedComment);
|
| + var vals = {};
|
| + params.forEach((paramName, paramHash) {
|
| + expect(_PARAM_VALUES, contains(paramName));
|
| + expect(paramHash['value'], _PARAM_VALUES[paramName],
|
| + reason: 'Value for $paramName should match expected');
|
| + });
|
| });
|
| });
|
| }
|
| +
|
| +final _PARAM_VALUES = {
|
| + "boolConst": "true",
|
| + "intConst": "42",
|
| + "listConst": '[true, 42, "Shanna", null, 3.14, []]',
|
| + "mapConst": startsWith("Map"),
|
| + "emptyMap": '{}',
|
| + "stringConst": "\"Shanna\""
|
| +};
|
|
|