test.dart包是否正常工作

时间:2015-04-17 11:28:22

标签: dart dart-polymer

我正在尝试运行从https://github.com/dart-lang/test/blob/master/README.md#asynchronous-tests

复制的简单测试
library epimss_reg.test;

import 'package:test/test.dart';
//import 'package:epimss_reg/epimss_reg.dart';

import "dart:async";


void main() {
  test("Stream.fromIterable() emits the values in the iterable", () {
    var stream = new Stream.fromIterable([1, 2, 3]);

    stream.listen(expectAsync((number) {
      print(number);
      expect(number, inInclusiveRange(1, 7));
    }, count: 3));
  });
}

当我使用as&#34运行应用程序时;运行为' Dart命令行启动'"我收到以下控制台报告

Observatory listening on http://127.0.0.1:50888

00:00 [32m+0[0m: Stream.fromIterable() emits the values in the iterable[0m
1
2
3

00:00 [32m+1[0m: Stream.fromIterable() emits the values in the iterable[0m

00:00 [32m+1[0m: All tests passed![0m

不是那样'所有测试都通过了!'但是当范围应该是包含范围(1,3)时,这是怎么回事?

由于

1 个答案:

答案 0 :(得分:0)

更改范围时测试失败,例如

expect(number, inInclusiveRange(1, 2));

因为3 >= 1 <= 2