d986ab830e
Change-Id: I4a9e2210b2b9923ffd7b33073a7b0ea7946f1438 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136520 Commit-Queue: Jaime Wren <jwren@google.com> Reviewed-by: Devon Carew <devoncarew@google.com>
45 lines
1016 B
Dart
45 lines
1016 B
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:dartdev/src/utils.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('pluralize', () {
|
|
test('zero', () {
|
|
expect(pluralize('cat', 0), 'cats');
|
|
});
|
|
|
|
test('one', () {
|
|
expect(pluralize('cat', 1), 'cat');
|
|
});
|
|
|
|
test('many', () {
|
|
expect(pluralize('cat', 2), 'cats');
|
|
});
|
|
});
|
|
|
|
group('trimEnd', () {
|
|
test('null string', () {
|
|
expect(trimEnd(null, 'suffix'), null);
|
|
});
|
|
|
|
test('null suffix', () {
|
|
expect(trimEnd('string', null), 'string');
|
|
});
|
|
|
|
test('suffix empty', () {
|
|
expect(trimEnd('string', ''), 'string');
|
|
});
|
|
|
|
test('suffix miss', () {
|
|
expect(trimEnd('string', 'suf'), 'string');
|
|
});
|
|
|
|
test('suffix hit', () {
|
|
expect(trimEnd('string', 'ring'), 'st');
|
|
});
|
|
});
|
|
}
|