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

Side by Side Diff: dart/tests/try/poi/library_updater_test.dart

Issue 747933002: Quick fixes to broken tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test of LibraryUpdater. 5 // Test of LibraryUpdater.
6 library trydart.library_updater_test; 6 library trydart.library_updater_test;
7 7
8 import 'dart:convert' show 8 import 'dart:convert' show
9 UTF8; 9 UTF8;
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 Future run() => mainApp.then((LibraryElement library) { 36 Future run() => mainApp.then((LibraryElement library) {
37 LibraryUpdater updater = 37 LibraryUpdater updater =
38 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog); 38 new LibraryUpdater(this.compiler, null, scriptUri, nolog, nolog);
39 bool actualCanReuse = 39 bool actualCanReuse =
40 updater.canReuseLibrary(library, UTF8.encode(newSource)); 40 updater.canReuseLibrary(library, UTF8.encode(newSource));
41 Expect.equals(expectedCanReuse, actualCanReuse); 41 Expect.equals(expectedCanReuse, actualCanReuse);
42 42
43 Expect.setEquals( 43 Expect.setEquals(
44 expectedUpdates.toSet(), 44 expectedUpdates.toSet(),
45 updater.updates.map((Update update) => update.before.name).toSet()); 45 updater.updates.map(nameOfUpdate).toSet());
46 }); 46 });
47 47
48 String toString() => 'Before:\n$source\n\n\nAfter:\n$newSource'; 48 String toString() => 'Before:\n$source\n\n\nAfter:\n$newSource';
49 } 49 }
50 50
51 String nameOfUpdate(Update update) {
52 var element = update.before;
53 if (element == null) element = update.after;
54 return element.name;
55 }
56
51 void main() { 57 void main() {
52 runTests( 58 runTests(
53 [ 59 [
54 // Only method body changed. Can be reused if 'main' is 60 // Only method body changed. Can be reused if 'main' is
55 // updated/patched. 61 // updated/patched.
56 new LibraryUpdaterTestCase( 62 new LibraryUpdaterTestCase(
57 before: 'main() { print("Hello, World!"); }', 63 before: 'main() { print("Hello, World!"); }',
58 after: 'main() { print("Hello, Brave New World!"); }', 64 after: 'main() { print("Hello, Brave New World!"); }',
59 canReuse: true, 65 canReuse: true,
60 updates: ['main']), 66 updates: ['main']),
61 67
62 // Signature changed. Can't be reused. 68 // Signature changed. Can't be reused.
63 new LibraryUpdaterTestCase( 69 new LibraryUpdaterTestCase(
64 before: 'main() { print("Hello, World!"); }', 70 before: 'main() { print("Hello, World!"); }',
65 after: 'void main() { print("Hello, World!"); }', 71 after: 'void main() { print("Hello, World!"); }',
66 canReuse: false, 72 canReuse: true,
67 updates: []), 73 updates: ['main']),
68 74
69 // Only whitespace changes. Can be reused; no updates/patches needed. 75 // Only whitespace changes. Can be reused; no updates/patches needed.
70 new LibraryUpdaterTestCase( 76 new LibraryUpdaterTestCase(
71 before: 'main(){print("Hello, World!");}', 77 before: 'main(){print("Hello, World!");}',
72 after: 'main() { print ( "Hello, World!" ) ; }', 78 after: 'main() { print ( "Hello, World!" ) ; }',
73 canReuse: true, 79 canReuse: true,
74 updates: []), 80 updates: []),
75 81
76 // Only whitespace/comment changes (in signature). Can be reused; no 82 // Only whitespace/comment changes (in signature). Can be reused; no
77 // updates/patches needed. 83 // updates/patches needed.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 new LibraryUpdaterTestCase( 118 new LibraryUpdaterTestCase(
113 before: 'main() => null;', 119 before: 'main() => null;',
114 after: 'main() {}', 120 after: 'main() {}',
115 canReuse: true, 121 canReuse: true,
116 updates: ['main']), 122 updates: ['main']),
117 123
118 // TODO(ahe): When supporting class members, test abstract methods. 124 // TODO(ahe): When supporting class members, test abstract methods.
119 ] 125 ]
120 ); 126 );
121 } 127 }
OLDNEW
« no previous file with comments | « dart/pkg/dart2js_incremental/lib/library_updater.dart ('k') | dart/tests/try/poi/serialize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698