Skip to content

Commit 4de7603

Browse files
committed
🎨 Changed wrapping only empty with quotes to wrapping String types with quotes
1 parent 0ac3736 commit 4de7603

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

lib/src/test_options/value_with_test_options.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ValueWithTestOptions extends Iterable<dynamic> {
88
final TestOptions testOptions;
99

1010
String get description =>
11-
'[ ${value.map((e) => e.toString().trim().isEmpty ? '\'$e\'' : e.toString()).join(', ')} ]';
11+
'[ ${value.map((e) => e is String ? '\'$e\'' : e.toString()).join(', ')} ]';
1212

1313
@override
1414
Iterator<dynamic> get iterator => value.iterator;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import 'package:parameterized_test/src/test_options/test_options.dart';
2+
import 'package:parameterized_test/src/test_options/value_with_test_options.dart';
3+
import 'package:test/test.dart';
4+
5+
void main() {
6+
final TestOptions testOptions = TestOptions();
7+
8+
group('description tests', () {
9+
test('ValueWithTestOptions with only String values are wrapped with \'quotes\'', () {
10+
final result = ValueWithTestOptions(
11+
['a', 'b', '', ' '],
12+
testOptions,
13+
).description;
14+
15+
expect(result, "[ 'a', 'b', '', ' ' ]");
16+
});
17+
18+
test('ValueWithTestOptions with mixed types only String values are wrapped with \'quotes\'', () {
19+
final result = ValueWithTestOptions(
20+
['a', 'b', '', ' ', 1, 1.5, true, _ClassWithToString()],
21+
testOptions,
22+
).description;
23+
24+
expect(result, "[ 'a', 'b', '', ' ', 1, 1.5, true, class with toString ]");
25+
});
26+
27+
});
28+
}
29+
30+
class _ClassWithToString {
31+
@override
32+
String toString() => 'class with toString';
33+
}

0 commit comments

Comments
 (0)