Skip to content

Commit

Permalink
Make a text string more generic to pass head analyzer (#2796)
Browse files Browse the repository at this point in the history
* Make the text string more generic to pass head analyzer

* Break up a more complicated case
  • Loading branch information
jcollins-g authored Sep 20, 2021
1 parent 6a25cd2 commit 3a892e9
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/mustachio/runtime_renderer_render_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -571,24 +571,26 @@ line 1, column 9 of ${fooTemplateFile.path}: Failed to resolve 's2' as a propert
var barTemplateFile = getFile('/project/src/bar.mustache');
expect(
() async => await Template.parse(barTemplateFile),
throwsA(const TypeMatcher<FileSystemException>().having(
(e) => e.message,
'message',
contains('"${barTemplateFile.path}" does not exist.'))));
throwsA(const TypeMatcher<FileSystemException>()
.having((e) => e.message, 'message', contains('does not exist.'))));
});

test('Template parser throws when it cannot read a partial', () async {
var barTemplateFile = getFile('/project/src/bar.mustache')
..writeAsStringSync('Text {{#foo}}{{>missing.mustache}}{{/foo}}');
var missingTemplateFile = getFile('/project/src/missing.mustache');
expect(
() async => await Template.parse(barTemplateFile),
throwsA(const TypeMatcher<MustachioResolutionError>()
.having((e) => e.message, 'message', contains('''
line 1, column 14 of ${barTemplateFile.path}: FileSystemException (File "${missingTemplateFile.path}" does not exist.) when reading partial:
throwsA(const TypeMatcher<MustachioResolutionError>().having(
(e) => e.message,
'message',
allOf(
contains('''
line 1, column 14 of ${barTemplateFile.path}: FileSystemException'''),
contains('''does not exist.'''),
contains('''when reading partial:
1 │ Text {{#foo}}{{>missing.mustache}}{{/foo}}
│ ^^^^^^^^^^^^^^^^^^^^^
'''))));
''')))));
});
}

0 comments on commit 3a892e9

Please sign in to comment.