Task: Add TextFormatter function to format the string with args

This commit is contained in:
2021-05-14 16:57:36 +07:00
parent a4264bb5e2
commit 5f282e4b59
4 changed files with 64 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
import 'package:configurable/text_formatter.dart';
import 'package:test/test.dart';
void main() {
test('text formatter function format', () {
var text1 = 'Hello, {0}!';
var result1 = TextFormatter(text1).format(['Sambo']);
var text2 = 'Hello, {name}!';
var result2 = TextFormatter(text2).decorate({'name': 'Chea'});
expect('Hello, Sambo!', result1);
expect('Hello, Chea!', result2);
});
}