說我在DART文件hello.dart
定義的私有函數:如何測試Dart中的私人功能?
_hello() {
return "world";
}
我想測試它在另一個文件mytest.dart
:
library mytest;
import 'dart:unittest/unittest.dart';
main() {
test('test private functions',() {
expect(_hello(), equals("world"));
}
}
但不幸的是,測試代碼不能編譯。但我確實需要測試那個私人_hello
函數。有沒有解決方法?
相關:http://stackoverflow.com/questions/19677724/dart-unit-testing-private-methods – Freewind