-
Notifications
You must be signed in to change notification settings - Fork 62
Closed
dart-archive/code_builder
#294Labels
Description
If you test/run the following snippet:
import 'package:test/test.dart';
import 'package:code_builder/code_builder.dart';
void main() {
test('test equalsDart',() {
const actual = Code("final x='x';");
expect(actual, equalsDart("final x='y';"));
});
}
The following error will be generated:
Expected: final x='y';
Actual: StaticCode:<final x='x';>
Which: final x='x';is different.
Expected: final x='x';
Actual: final x='y';
^
Differ at offset 9
Please notice the switch up of Expected
and Actual
on the fourth and fifth lines, which should be referring to the same actual and expected as the first and second line. actual
should be referring to the first parameter of expect
and not the content of the matcher, since the parameter is also named actual
and all other matchers confirm to that spec.
This wrong message gets confusing fast, especially when testing larger code generation output where the exact mismatch location is harder to find.