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

Side by Side Diff: test/refactor_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/observable_transform_test.dart ('k') | test/run_all.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 library polymer.test.refactor_test;
6
7 import 'package:unittest/compact_vm_config.dart';
8 import 'package:unittest/unittest.dart';
9 import 'package:polymer/src/refactor.dart';
10 import 'package:source_maps/span.dart';
11
12 main() {
13 useCompactVMConfiguration();
14 var original = "0123456789abcdefghij";
15 var file = new SourceFile.text('', original);
16
17 test('non conflicting, in order edits', () {
18 var txn = new TextEditTransaction(original, file);
19 txn.edit(2, 4, '.');
20 txn.edit(5, 5, '|');
21 txn.edit(6, 6, '-');
22 txn.edit(6, 7, '_');
23 expect((txn.commit()..build('')).text, "01.4|5-_789abcdefghij");
24 });
25
26 test('non conflicting, out of order edits', () {
27 var txn = new TextEditTransaction(original, file);
28 txn.edit(2, 4, '.');
29 txn.edit(5, 5, '|');
30
31 // Regresion test for issue #404: there is no conflict/overlap for edits
32 // that don't remove any of the original code.
33 txn.edit(6, 7, '_');
34 txn.edit(6, 6, '-');
35 expect((txn.commit()..build('')).text, "01.4|5-_789abcdefghij");
36
37 });
38
39 test('non conflicting edits', () {
40 var txn = new TextEditTransaction(original, file);
41 txn.edit(2, 4, '.');
42 txn.edit(3, 3, '-');
43 expect(() => txn.commit(), throwsA(predicate(
44 (e) => e.toString().contains('overlapping edits'))));
45 });
46 }
OLDNEW
« no previous file with comments | « test/observable_transform_test.dart ('k') | test/run_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698