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

Side by Side Diff: tests/lib/convert/codec2_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 import 'dart:convert'; 5 import 'dart:convert';
6 6
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 8
9 main() { 9 main() {
10 final RAW = '["122ç",50,50,231]'; 10 final RAW = '["122ç",50,50,231]';
11 final ENCODED = const [91, 34, 49, 50, 50, 195, 167, 34, 44, 11 final ENCODED = const [
12 53, 48, 44, 53, 48, 44, 50, 51, 49, 93]; 12 91,
13 34,
14 49,
15 50,
16 50,
17 195,
18 167,
19 34,
20 44,
21 53,
22 48,
23 44,
24 53,
25 48,
26 44,
27 50,
28 51,
29 49,
30 93
31 ];
13 Expect.listEquals(ENCODED, UTF8.encode(RAW)); 32 Expect.listEquals(ENCODED, UTF8.encode(RAW));
14 Expect.equals(RAW, UTF8.decode(ENCODED)); 33 Expect.equals(RAW, UTF8.decode(ENCODED));
15 34
16 Expect.listEquals([], UTF8.encode("")); 35 Expect.listEquals([], UTF8.encode(""));
17 Expect.equals("", UTF8.decode([])); 36 Expect.equals("", UTF8.decode([]));
18 37
19 final JSON_ENCODED = RAW; 38 final JSON_ENCODED = RAW;
20 Expect.equals(JSON_ENCODED, JSON.encode(["122ç", 50, 50, 231])); 39 Expect.equals(JSON_ENCODED, JSON.encode(["122ç", 50, 50, 231]));
21 Expect.listEquals(["122ç", 50, 50, 231], JSON.decode(JSON_ENCODED)); 40 Expect.listEquals(["122ç", 50, 50, 231], JSON.decode(JSON_ENCODED));
22 41
(...skipping 10 matching lines...) Expand all
33 decoded = jsonWithReviver.decode('{"p": 5}'); 52 decoded = jsonWithReviver.decode('{"p": 5}');
34 Expect.equals(10, decoded["p"]); 53 Expect.equals(10, decoded["p"]);
35 54
36 // Test example from comments. 55 // Test example from comments.
37 final JSON_TO_BYTES = JSON.fuse(UTF8); 56 final JSON_TO_BYTES = JSON.fuse(UTF8);
38 List<int> bytes = JSON_TO_BYTES.encode(["json-object"]); 57 List<int> bytes = JSON_TO_BYTES.encode(["json-object"]);
39 decoded = JSON_TO_BYTES.decode(bytes); 58 decoded = JSON_TO_BYTES.decode(bytes);
40 Expect.isTrue(decoded is List); 59 Expect.isTrue(decoded is List);
41 Expect.equals("json-object", decoded[0]); 60 Expect.equals("json-object", decoded[0]);
42 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698