Read a data file for unit test in Dart

Viewed 661

I'm using this snippet to read a data file in a unit test:

var file = new File('/Users/chambery/projects/Foo/src/resources/skills.yaml');
Future<String> finishedReading = file.readAsString();
finishedReading.then((text) {
  print(text);
  print(loadYaml(text));
});

Running in the Dart Editor I get no error (but no printout),

...
PASS: calc_ranks
PASS: load_skills

All 7 tests passed.
unittest-suite-success

(edit: removed command line error; dart vm was out-of-date)

I don't need async file read.

1 Answers
Related