Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: develop a crate to parse cwl documents #4

Merged
merged 21 commits into from
Jan 5, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add tests
nsyzrantsev committed Jan 4, 2025
commit b5f787633d749ade37ea79891162fb27e1c88afb
10 changes: 10 additions & 0 deletions zefiro-core/zefiro-cwl-parser/src/schema/document.rs
Original file line number Diff line number Diff line change
@@ -130,11 +130,21 @@ impl FromStr for CwlSchema {
mod tests {
use super::*;
use rstest::rstest;
use std::io::BufWriter;

#[rstest]
#[case("examples/data/clt-step-schema.yml")]
#[case("examples/data/wf-step-schema.yml")]
fn test_parse_correct_schema(#[case] file_path: &str) {
CwlSchema::from_path(file_path).expect("Failed to deserialize CWL schema document");
}

#[rstest]
#[case("examples/data/clt-step-schema.yml", tempfile::tempfile().unwrap())]
#[case("examples/data/wf-step-schema.yml", tempfile::tempfile().unwrap())]
fn test_save_schema_to_yaml(#[case] file_path: &str, #[case] output_path: File) {
let schema = CwlSchema::from_path(file_path).expect("Failed to deserialize CWL schema document");
let writer = BufWriter::new(output_path);
let _ = schema.to_yaml(writer);
}
}
9 changes: 9 additions & 0 deletions zefiro-core/zefiro-cwl-parser/src/values/document.rs
Original file line number Diff line number Diff line change
@@ -102,10 +102,19 @@ impl CwlValues {
mod tests {
use super::*;
use rstest::rstest;
use std::io::BufWriter;

#[rstest]
#[case("examples/data/clt-step-values.yml")]
fn test_parse_correct_values(#[case] file_path: &str) {
CwlValues::from_path(file_path).expect("Failed to deserialize CWL values document");
}

#[rstest]
#[case("examples/data/clt-step-values.yml", tempfile::tempfile().unwrap())]
fn test_save_schema_to_yaml(#[case] file_path: &str, #[case] output_path: File) {
let schema = CwlValues::from_path(file_path).expect("Failed to deserialize CWL values document");
let writer = BufWriter::new(output_path);
let _ = schema.to_yaml(writer);
}
}