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

Side by Side Diff: test/observable_transform_test.dart

Issue 22962005: Merge pull request #581 from kevmoo/polymer (Closed) Base URL: https://github.com/dart-lang/web-ui.git@polymer
Patch Set: Created 7 years, 4 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/css_test.dart ('k') | test/refactor_test.dart » ('j') | 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) 2013, 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 import 'package:unittest/compact_vm_config.dart';
6 import 'package:unittest/unittest.dart';
7 import 'package:polymer/src/dart_parser.dart';
8 import 'package:polymer/src/messages.dart';
9 import 'package:polymer/src/observable_transform.dart';
10
11 main() {
12 useCompactVMConfiguration();
13
14 group('fixes contructor calls ', () {
15 testInitializers('this.a', '(a) : __\$a = a');
16 testInitializers('{this.a}', '({a}) : __\$a = a');
17 testInitializers('[this.a]', '([a]) : __\$a = a');
18 testInitializers('this.a, this.b', '(a, b) : __\$a = a, __\$b = b');
19 testInitializers('{this.a, this.b}', '({a, b}) : __\$a = a, __\$b = b');
20 testInitializers('[this.a, this.b]', '([a, b]) : __\$a = a, __\$b = b');
21 testInitializers('this.a, [this.b]', '(a, [b]) : __\$a = a, __\$b = b');
22 testInitializers('this.a, {this.b}', '(a, {b}) : __\$a = a, __\$b = b');
23 });
24 }
25
26 testInitializers(String args, String expected) {
27 test(args, () {
28
29 var constructor = 'MyClass(';
30
31 var code = '''
32 class MyClass {
33 @observable var a;
34 @observable var b;
35 MyClass($args);
36 }''';
37
38 var edit = transformObservables(parseDartCode('<test>', code, null),
39 new Messages.silent());
40 expect(edit, isNotNull);
41 var output = (edit.commit()..build('<test>')).text;
42
43 var begin = output.indexOf(constructor) + constructor.length - 1;
44 var end = output.indexOf(';', begin);
45 if (end == -1) end = output.length;
46 var init = output.substring(begin, end).trim().replaceAll(' ', ' ');
47
48 expect(init, expected);
49 });
50 }
OLDNEW
« no previous file with comments | « test/css_test.dart ('k') | test/refactor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698