Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
Only copy the enabled encodings' tests to the output package
Browse files Browse the repository at this point in the history
  • Loading branch information
jerel authored and ma2bd committed Nov 15, 2021
1 parent 118bd89 commit b4d5424
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion serde-generate/src/dart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,21 @@ impl crate::SourceInstaller for Installer {
let generator = CodeGenerator::new(config);
generator.output(self.install_dir.clone(), registry)?;
generator.output_test(&self.install_dir)?;
self.install_runtime(include_directory!("runtime/dart/test"), "test/src")?;
std::fs::create_dir_all(self.install_dir.join("test/src")).unwrap();

let tests = include_directory!("runtime/dart/test");
let mv_test = |file| {
std::fs::copy(
tests.path().join("runtime/dart/test").join(&file),
self.install_dir.join("test/src").join(&file),
)
.unwrap();
};

mv_test("serde.dart".to_string());
for encoding in &config.encodings {
mv_test(encoding.name().to_snake_case() + ".dart");
}

// write the main module file to export the public api
std::fs::write(
Expand Down

0 comments on commit b4d5424

Please sign in to comment.