dynamic_extensions_test.dart
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import 'package:flutter_test/flutter_test.dart';
import 'package:get/utils.dart';
void main() {
group('Log Extension', () {
test('String test', () {
var value = 'string';
var expected = '';
void logFunction(String prefix, dynamic value, String info) {
print('algo');
expected = '$prefix $value $info'.trim();
}
value.printError(logFunction: logFunction);
expect(expected, 'Error: String string');
});
test('Int test', () {
var value = 1;
var expected = '';
void logFunction(String prefix, dynamic value, String info) {
expected = '$prefix $value $info'.trim();
}
value.printError(logFunction: logFunction);
expect(expected, 'Error: int 1');
});
test('Double test', () {
var value = 1.0;
var expected = '';
void logFunction(String prefix, dynamic value, String info) {
expected = '$prefix $value $info'.trim();
}
value.printError(logFunction: logFunction);
expect(expected, 'Error: double 1.0');
});
});
}