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

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

Issue 2232273004: Delete site/try (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Test [source_update.dart].
6 library trydart.source_update_test;
7
8 import 'dart:convert' show
9 JSON;
10
11 import 'package:expect/expect.dart' show
12 Expect;
13
14 import 'source_update.dart' show
15 expandDiff,
16 expandUpdates,
17 splitFiles,
18 splitLines;
19
20 main() {
21 Expect.listEquals(
22 ["head v1 tail", "head v2 tail"],
23 expandUpdates(["head ", ["v1", "v2"], " tail"]));
24
25 Expect.listEquals(
26 ["head v1 tail v2", "head v2 tail v1"],
27 expandUpdates(["head ", ["v1", "v2"], " tail ", ["v2", "v1"]]));
28
29 Expect.throws(() {
30 expandUpdates(["head ", ["v1", "v2"], " tail ", ["v1"]]);
31 });
32
33 Expect.throws(() {
34 expandUpdates(["head ", ["v1", "v2"], " tail ", ["v1", "v2", "v3"]]);
35 });
36
37 Expect.stringEquals(
38 JSON.encode({
39 "file1.dart": """
40 First line of file 1.
41 Second line of file 1.
42 Third line of file 1.
43 """,
44 "empty.dart":"",
45 "file2.dart":"""
46 First line of file 2.
47 Second line of file 2.
48 Third line of file 2.
49 """}),
50
51 JSON.encode(splitFiles(r"""
52 ==> file1.dart <==
53 First line of file 1.
54 Second line of file 1.
55 Third line of file 1.
56 ==> empty.dart <==
57 ==> file2.dart <==
58 First line of file 2.
59 Second line of file 2.
60 Third line of file 2.
61 """)));
62
63 Expect.stringEquals("{}", JSON.encode(splitFiles("")));
64
65 Expect.stringEquals("[]", JSON.encode(splitLines("")));
66
67 Expect.stringEquals('["1"]', JSON.encode(splitLines("1")));
68
69 Expect.stringEquals('["\\n"]', JSON.encode(splitLines("\n")));
70
71 Expect.stringEquals('["\\n","1"]', JSON.encode(splitLines("\n1")));
72
73 Expect.stringEquals(
74 '["","",""]',
75 JSON.encode(expandUpdates(expandDiff(r"""
76 <<<<<<<
77 =======
78 =======
79 >>>>>>>
80 """))));
81
82 Expect.stringEquals(
83 r'["first\nv1\nlast\n","first\nv2\nlast\n","first\nv3\nlast\n"]',
84 JSON.encode(expandUpdates(expandDiff(r"""
85 first
86 <<<<<<<
87 v1
88 =======
89 v2
90 =======
91 v3
92 >>>>>>>
93 last
94 """))));
95
96 Expect.stringEquals(
97 r'["v1\nlast\n","v2\nlast\n","v3\nlast\n"]',
98 JSON.encode(expandUpdates(expandDiff(r"""
99 <<<<<<<
100 v1
101 =======
102 v2
103 =======
104 v3
105 >>>>>>>
106 last
107 """))));
108
109 Expect.stringEquals(
110 r'["v1\n","v2\n","v3\n"]',
111 JSON.encode(expandUpdates(expandDiff(r"""
112 <<<<<<<
113 v1
114 =======
115 v2
116 =======
117 v3
118 >>>>>>>
119 """))));
120 }
OLDNEW
« dart.gyp ('K') | « tests/try/poi/source_update.dart ('k') | tests/try/safari.applescript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698