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

Side by Side Diff: utils/tests/string_encoding/utf16_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « utils/tests/string_encoding/dunit.dart ('k') | utils/tests/string_encoding/utf32_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 library utf16_tests; 6 library utf16_tests;
7 import 'dunit.dart'; 7 import 'dunit.dart';
8 import '../../string_encoding/unicode_core.dart'; 8 import '../../string_encoding/unicode_core.dart';
9 import '../../string_encoding/utf16.dart'; 9 import '../../string_encoding/utf16.dart';
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Expect.stringEquals(testHanWater, 106 Expect.stringEquals(testHanWater,
107 decodeUtf16le([0xFF, 0xFE, 0x34, 0x6C]), 107 decodeUtf16le([0xFF, 0xFE, 0x34, 0x6C]),
108 "Water variation 7"); 108 "Water variation 7");
109 109
110 Expect.stringEquals(testKoreanCharSubset, 110 Expect.stringEquals(testKoreanCharSubset,
111 decodeUtf16(testKoreanCharSubsetUtf16beBom), "UTF-16BE Korean"); 111 decodeUtf16(testKoreanCharSubsetUtf16beBom), "UTF-16BE Korean");
112 } 112 }
113 113
114 void testIterableMethods() { 114 void testIterableMethods() {
115 // empty input 115 // empty input
116 Expect.isFalse(decodeUtf16AsIterable([]).iterator().hasNext); 116 Expect.isFalse(decodeUtf16AsIterable([]).iterator.moveNext());
117 117
118 IterableUtf16Decoder koreanDecoder = 118 IterableUtf16Decoder koreanDecoder =
119 decodeUtf16AsIterable(testKoreanCharSubsetUtf16beBom); 119 decodeUtf16AsIterable(testKoreanCharSubsetUtf16beBom);
120 // get the first character 120 // get the first character
121 Expect.equals(testKoreanCharSubset.charCodes[0], 121 Expect.equals(testKoreanCharSubset.charCodes[0], koreanDecoder.first);
122 koreanDecoder.iterator().next());
123 // get the whole translation using the Iterable interface 122 // get the whole translation using the Iterable interface
124 Expect.stringEquals(testKoreanCharSubset, 123 Expect.stringEquals(testKoreanCharSubset,
125 new String.fromCharCodes(new List<int>.from(koreanDecoder))); 124 new String.fromCharCodes(new List<int>.from(koreanDecoder)));
126 125
127 // specify types 126 // specify types
128 Expect.equals(44032, (new List<int> 127 Expect.equals(44032, (new List<int>
129 .from(decodeUtf16beAsIterable(testKoreanCharSubsetUtf16beBom)))[0]); 128 .from(decodeUtf16beAsIterable(testKoreanCharSubsetUtf16beBom)))[0]);
130 Expect.equals(44032, (new List<int> 129 Expect.equals(44032, (new List<int>
131 .from(decodeUtf16leAsIterable(testKoreanCharSubsetUtf16le)))[0]); 130 .from(decodeUtf16leAsIterable(testKoreanCharSubsetUtf16le)))[0]);
132 Expect.equals(UNICODE_BOM, (new List<int> 131 Expect.equals(UNICODE_BOM, (new List<int>
133 .from(decodeUtf16beAsIterable(testKoreanCharSubsetUtf16beBom, 132 .from(decodeUtf16beAsIterable(testKoreanCharSubsetUtf16beBom,
134 stripBom: false)))[0]); 133 stripBom: false)))[0]);
135 } 134 }
136 } 135 }
OLDNEW
« no previous file with comments | « utils/tests/string_encoding/dunit.dart ('k') | utils/tests/string_encoding/utf32_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698