Skip to content

Commit 50aa54c

Browse files
committed
update-test
1 parent 786f629 commit 50aa54c

File tree

1 file changed

+72
-36
lines changed

1 file changed

+72
-36
lines changed

test/mustachio/runtime_renderer_builder_test.dart

Lines changed: 72 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
library;
88

99
import 'dart:io';
10+
1011
import 'package:analyzer/dart/element/element.dart';
1112
import 'package:test/test.dart';
1213
import 'package:test_descriptor/test_descriptor.dart' as d;
@@ -98,49 +99,78 @@ class Baz {}
9899

99100
test('with a property map with a bool property', () {
100101
expect(generatedContent, contains('''
101-
'b1': Property(
102-
getValue: (CT_ c) => c.b1,
103-
renderVariable: (CT_ c, Property<CT_> self,
104-
List<String> remainingNames) =>
105-
self.renderSimpleVariable(c, remainingNames, 'bool'),
106-
getBool: (CT_ c) => c.b1,
107-
),
102+
'b1': Property(
103+
getValue: (CT_ c) => c.b1,
104+
renderVariable:
105+
(CT_ c, Property<CT_> self, List<String> remainingNames) =>
106+
self.renderSimpleVariable(c, remainingNames, 'bool'),
107+
108+
getBool: (CT_ c) => c.b1,
109+
),
108110
'''));
109111
});
110112

111113
test('with a property map with an Iterable property', () {
112114
expect(generatedContent, contains('''
113-
'l1': Property(
114-
getValue: (CT_ c) => c.l1,
115-
renderVariable: (CT_ c, Property<CT_> self,
116-
List<String> remainingNames) =>
117-
self.renderSimpleVariable(c, remainingNames, 'List<int>'),
118-
renderIterable: (CT_ c, RendererBase<CT_> r,
119-
List<MustachioNode> ast, StringSink sink) {
120-
return c.l1.map((e) => renderSimple(
121-
e, ast, r.template, sink,
122-
parent: r, getters: _invisibleGetters['int']!));
123-
},
124-
),
115+
'l1': Property(
116+
getValue: (CT_ c) => c.l1,
117+
renderVariable:
118+
(CT_ c, Property<CT_> self, List<String> remainingNames) =>
119+
self.renderSimpleVariable(
120+
c,
121+
remainingNames,
122+
'List<int>',
123+
),
124+
125+
renderIterable: (
126+
CT_ c,
127+
RendererBase<CT_> r,
128+
List<MustachioNode> ast,
129+
StringSink sink,
130+
) {
131+
return c.l1.map(
132+
(e) => renderSimple(
133+
e,
134+
ast,
135+
r.template,
136+
sink,
137+
parent: r,
138+
getters: _invisibleGetters['int']!,
139+
),
140+
);
141+
},
142+
),
125143
'''));
126144
});
127145

128146
test(
129147
'with a property map with a non-bool, non-Iterable, non-nullable property',
130148
() {
131149
expect(generatedContent, contains('''
132-
's1': Property(
133-
getValue: (CT_ c) => c.s1,
134-
renderVariable: (CT_ c, Property<CT_> self,
135-
List<String> remainingNames) =>
136-
self.renderSimpleVariable(c, remainingNames, 'String'),
137-
isNullValue: (CT_ c) => false,
138-
renderValue: (CT_ c, RendererBase<CT_> r,
139-
List<MustachioNode> ast, StringSink sink) {
140-
renderSimple(c.s1, ast, r.template, sink,
141-
parent: r, getters: _invisibleGetters['String']!);
142-
},
143-
),
150+
's1': Property(
151+
getValue: (CT_ c) => c.s1,
152+
renderVariable:
153+
(CT_ c, Property<CT_> self, List<String> remainingNames) =>
154+
self.renderSimpleVariable(c, remainingNames, 'String'),
155+
156+
isNullValue: (CT_ c) => false,
157+
158+
renderValue: (
159+
CT_ c,
160+
RendererBase<CT_> r,
161+
List<MustachioNode> ast,
162+
StringSink sink,
163+
) {
164+
renderSimple(
165+
c.s1,
166+
ast,
167+
r.template,
168+
sink,
169+
parent: r,
170+
getters: _invisibleGetters['String']!,
171+
);
172+
},
173+
),
144174
'''));
145175
});
146176
});
@@ -196,9 +226,15 @@ import 'annotations.dart';
196226

197227
test('with a corresponding render function', () async {
198228
expect(
199-
generatedContent,
200-
contains('void _render_Foo<T>(\n'
201-
' Foo<T> context, List<MustachioNode> ast, Template template, StringSink sink,\n'));
229+
generatedContent,
230+
contains('''
231+
void _render_Foo<T>(
232+
Foo<T> context,
233+
List<MustachioNode> ast,
234+
Template template,
235+
StringSink sink, {
236+
'''),
237+
);
202238
});
203239

204240
test('with a generic supertype type argument', () async {
@@ -210,14 +246,14 @@ import 'annotations.dart';
210246
'with a property map which references the superclass with a type '
211247
'variable', () {
212248
expect(generatedContent,
213-
contains('..._Renderer_FooBase.propertyMap<T, CT_>(),'));
249+
contains('..._Renderer_FooBase.propertyMap<T, CT_>()'));
214250
});
215251

216252
test(
217253
'with a property map which references the superclass with an interface '
218254
'type', () {
219255
expect(generatedContent,
220-
contains('..._Renderer_BarBase.propertyMap<int, CT_>(),'));
256+
contains('..._Renderer_BarBase.propertyMap<int, CT_>()'));
221257
});
222258
});
223259

0 commit comments

Comments
 (0)