blob: be84f595ded897f17a54c542637b625b1288718e [file] [log] [blame]
// 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');
});
});
}