trphoenix
2018-11-19 524fe036f63de1056aab457781e0b7141a5b7adc
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
// Copyright (c) 2018, 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.
 
@TestOn('vm')
 
import 'package:test/test.dart';
 
import 'package:json_serializable/src/utils.dart';
 
const _items = {
  'simple': 'simple',
  'twoWords': 'two-words',
  'FirstBig': 'first-big'
};
 
void main() {
  group('kebab', () {
    for (final entry in _items.entries) {
      test('"${entry.key}"', () {
        expect(kebabCase(entry.key), entry.value);
      });
    }
  });
 
  group('snake', () {
    for (final entry in _items.entries) {
      test('"${entry.key}"', () {
        expect(snakeCase(entry.key), entry.value.replaceAll('-', '_'));
      });
    }
  });
}