diff --git a/crates/rpl/src/lib.rs b/crates/rpl/src/lib.rs index 91180c1..6290fb2 100644 --- a/crates/rpl/src/lib.rs +++ b/crates/rpl/src/lib.rs @@ -14,23 +14,33 @@ pub fn from_ron(raw: &str) -> Rpl { #[derive(Serialize, Deserialize, PartialEq, Eq, Debug)] pub struct Rpl(pub Vec); -#[test] -fn test_simple_deserialize() { - const TEST_DATA: &str = - "([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])"; +#[cfg(test)] +mod tests { + use super::*; + use crate::instructions::{ + read::{SourceFormat, SourceType}, + write::{TargetFormat, TargetType}, + MathInstruction, + }; - assert_eq!( - from_ron(TEST_DATA), - Rpl(vec![ - Instruction::Read(instructions::read::Read { - source: SourceType::File("~/example/file.png".into()), - format: SourceFormat::Png - }), - Instruction::Math(MathInstruction::Add), - Instruction::Write(instructions::write::Write { - target: TargetType::File("~/example/out.jpg".into()), - format: TargetFormat::Jpeg - }) - ]) - ); + #[test] + fn test_simple_deserialize() { + const TEST_DATA: &str = + "([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])"; + + assert_eq!( + from_ron(TEST_DATA), + Rpl(vec![ + Instruction::Read(instructions::read::Read { + source: SourceType::File("~/example/file.png".into()), + format: SourceFormat::Png + }), + Instruction::Math(MathInstruction::Add), + Instruction::Write(instructions::write::Write { + target: TargetType::File("~/example/out.jpg".into()), + format: TargetFormat::Jpeg + }) + ]) + ); + } } diff --git a/flake.nix b/flake.nix index d8e5186..aa617a3 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,7 @@ just nushell typst typst-lsp mold + cargo-nextest ]; }) ]; diff --git a/justfile b/justfile index 3715e45..396f6eb 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,5 @@ +all: test docs + # Compile all documentation as in proposals and design documents, placing them under `docs/compiled`. docs: #!/usr/bin/env nu @@ -9,3 +11,7 @@ docs: ) mv $pdf docs/compiled } | ignore + +test: + #!/usr/bin/env nu + cargo nextest run