import 'package:dart_eval/dart_eval.dart';
import 'package:test/expect.dart';
import 'package:test/scaffolding.dart';
void main() {
group('constructor tests', () {
test('test constructor logic', () {
final program = '''
class TestClass {
int a = 1;
TestClass() {
a = 2;
}
}
int main () {
final test = TestClass();
return test.a;
}
''';
final result = eval(program, function: 'main');
expect(result, 2);
});
});
}
test case:
Error: package:matcher expect test/custom/constructor_test.dart 28:7 main..
Expected: <2> Actual: <1>