Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: test/utils_test.dart

Issue 1612083002: Initial --modules=es6 support (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: addressed comments (legacy, doc) + test enum utils Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dev_compiler.test.utils_test;
6
7 import 'package:dev_compiler/src/utils.dart';
8 import 'package:test/test.dart';
9
10 enum Foo {
11 first, second
12 }
13
14 void main() {
15 group('getEnumValue', () {
16 test('gets simple names', () {
17 expect(getEnumName(Foo.first), 'first');
18 });
19 test('chokes on invalid values', () {
20 expect(() => getEnumName(null), throws);
21 expect(() => getEnumName(''), throws);
22 expect(() => getEnumName('.'), throws);
23 expect(() => getEnumName('.a'), throws);
24 expect(() => getEnumName('a.'), throws);
25 });
26 });
27 group('parseEnum', () {
28 Foo parseFoo(String s) => parseEnum(s, Foo.values);
29 test('parses enums', () {
30 expect(parseFoo('first'), Foo.first);
31 expect(parseFoo('second'), Foo.second);
32 });
33 test('chokes on unknown enums', () {
34 expect(() => parseFoo(''), throws);
35 expect(() => parseFoo('what'), throws);
36 });
37 });
38 }
OLDNEW
« no previous file with comments | « test/codegen_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698