2021-06-01 23:03:54 +07:00
|
|
|
import 'package:cubetiq/text.dart';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
test('text formatter function format', () {
|
|
|
|
var text1 = 'Hello, {0}!';
|
2021-06-17 15:25:40 +07:00
|
|
|
var result1 = TextFormatter(text1).format(args: ['Sambo']);
|
2021-06-01 23:03:54 +07:00
|
|
|
|
|
|
|
var text2 = 'Hello, {name}!';
|
2021-06-17 15:25:40 +07:00
|
|
|
var result2 = TextFormatter(text2).decorate(params: {'name': 'Chea'});
|
2021-06-01 23:03:54 +07:00
|
|
|
|
|
|
|
expect('Hello, Sambo!', result1);
|
|
|
|
expect('Hello, Chea!', result2);
|
|
|
|
});
|
|
|
|
}
|