OLD | NEW |
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:async"; | 5 import "dart:async"; |
6 import "dart:collection"; | 6 import "dart:collection"; |
7 | 7 |
8 import "package:async/result.dart"; | 8 import "package:async/async.dart"; |
9 import "package:stack_trace/stack_trace.dart"; | 9 import "package:stack_trace/stack_trace.dart"; |
10 import "package:test/test.dart"; | 10 import "package:test/test.dart"; |
11 | 11 |
12 void main() { | 12 void main() { |
13 var stack = new Trace.current(); | 13 var stack = new Trace.current(); |
14 | 14 |
15 test("create result value", () { | 15 test("create result value", () { |
16 Result<int> result = new Result<int>.value(42); | 16 Result<int> result = new Result<int>.value(42); |
17 expect(result.isValue, isTrue); | 17 expect(result.isValue, isTrue); |
18 expect(result.isError, isFalse); | 18 expect(result.isError, isFalse); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 void add(T value) { onData(value); } | 330 void add(T value) { onData(value); } |
331 void addError(error, [StackTrace stack]) { onError(error, stack); } | 331 void addError(error, [StackTrace stack]) { onError(error, stack); } |
332 void close() { onDone(); } | 332 void close() { onDone(); } |
333 | 333 |
334 static void _nullData(value) { fail("Unexpected sink add: $value"); } | 334 static void _nullData(value) { fail("Unexpected sink add: $value"); } |
335 static void _nullError(e, StackTrace s) { | 335 static void _nullError(e, StackTrace s) { |
336 fail("Unexpected sink addError: $e"); | 336 fail("Unexpected sink addError: $e"); |
337 } | 337 } |
338 static void _nullDone() { fail("Unepxected sink close"); } | 338 static void _nullDone() { fail("Unepxected sink close"); } |
339 } | 339 } |
OLD | NEW |