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

Side by Side Diff: packages/quiver/test/core/hash_test.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/quiver/test/core/core_test.dart ('k') | packages/quiver/test/core/optional_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 // Copyright 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 part of quiver.testing.runtime; 15 library quiver.core.hash_test;
16 16
17 /** 17 import 'package:quiver/core.dart';
18 * Asserts that the current runtime has checked mode enabled. 18 import 'package:test/test.dart';
19 *
20 * Otherwise, throws [StateError].
21 */
22 void assertCheckedMode() {
23 if (_isCheckedMode == null) _isCheckedMode = _checkForCheckedMode();
24 19
25 if (!_isCheckedMode) { 20 main() {
26 throw new StateError('Not in checked mode.'); 21 test('hashObjects should return an int', () {
27 } 22 int h = hashObjects(['123', 456]);
23 expect(h, new isInstanceOf<int>());
24 });
25
26 test('hash2 should return an int', () {
27 int h = hash2('123', 456);
28 expect(h, new isInstanceOf<int>());
29 });
30
31 test('hash3 should return an int', () {
32 int h = hash3('123', 456, true);
33 expect(h, new isInstanceOf<int>());
34 });
35
36 test('hash4 should return an int', () {
37 int h = hash4('123', 456, true, []);
38 expect(h, new isInstanceOf<int>());
39 });
28 } 40 }
29
30 bool _isCheckedMode = null;
31
32 bool _checkForCheckedMode() {
33 Object sentinal = new Object();
34 try {
35 var i = 1 as dynamic;
36 String string = i;
37 throw sentinal;
38 } catch (e) {
39 if (e == sentinal) return false;
40 }
41 return true;
42 }
OLDNEW
« no previous file with comments | « packages/quiver/test/core/core_test.dart ('k') | packages/quiver/test/core/optional_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698