You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dateKeys-dart/tool/tlock_steps_copy.dart

28 lines
1.0 KiB

// Writes test/vectors/tlock_steps.g.dart, the text of
// testdata/vectors/tlock_steps.json as a Dart constant, for
// test/tlock_steps_test.dart compiled to JavaScript, where no file can be
// read. test/tlock_steps_vm_test.dart checks that the copy is the file byte
// for byte. Run it after every sync of testdata/.
//
// dart run tool/tlock_steps_copy.dart
import 'dart:io';
void main() {
final root = File(Platform.script.toFilePath()).parent.parent;
final json = File('${root.path}/testdata/vectors/tlock_steps.json')
.readAsStringSync();
if (json.contains("'''")) {
throw StateError('tlock_steps.json holds three quotes');
}
File('${root.path}/test/vectors/tlock_steps.g.dart').writeAsStringSync(
'// Generated by tool/tlock_steps_copy.dart from\n'
'// testdata/vectors/tlock_steps.json, for the tests that also run\n'
'// compiled to JavaScript, where no file can be read. Do not edit.\n'
'\n'
'/// The text of testdata/vectors/tlock_steps.json.\n'
"const tlockStepsJson = r'''\n"
"$json''';\n",
);
}

Powered by TurnKey Linux.