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

Side by Side Diff: pkg/codegen/test/refactor_test.dart

Issue 22396004: Make observable transform a barback transform. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 | Annotate | Revision Log
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/unittest.dart';
8 import 'package:codegen/refactor.dart';
9 import 'package:source_maps/span.dart';
10
11 main() {
12 var original = "0123456789abcdefghij";
13 var file = new SourceFile.text('', original);
14
15 test('non conflicting, in order edits', () {
16 var txn = new TextEditTransaction(original, file);
17 txn.edit(2, 4, '.');
18 txn.edit(5, 5, '|');
19 txn.edit(6, 6, '-');
20 txn.edit(6, 7, '_');
21 expect((txn.commit()..build('')).text, "01.4|5-_789abcdefghij");
22 });
23
24 test('non conflicting, out of order edits', () {
25 var txn = new TextEditTransaction(original, file);
26 txn.edit(2, 4, '.');
27 txn.edit(5, 5, '|');
28
29 // Regresion test for issue #404: there is no conflict/overlap for edits
30 // that don't remove any of the original code.
31 txn.edit(6, 7, '_');
32 txn.edit(6, 6, '-');
33 expect((txn.commit()..build('')).text, "01.4|5-_789abcdefghij");
34
35 });
36
37 test('non conflicting edits', () {
38 var txn = new TextEditTransaction(original, file);
39 txn.edit(2, 4, '.');
40 txn.edit(3, 3, '-');
41 expect(() => txn.commit(), throwsA(predicate(
42 (e) => e.toString().contains('overlapping edits'))));
43 });
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698