mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2024-11-21 21:24:41 +01:00
test: fix running tests
This commit is contained in:
parent
8f3c426359
commit
5bf277cf14
|
@ -14,23 +14,33 @@ pub fn from_ron(raw: &str) -> Rpl {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug)]
|
||||||
pub struct Rpl(pub Vec<Instruction>);
|
pub struct Rpl(pub Vec<Instruction>);
|
||||||
|
|
||||||
#[test]
|
#[cfg(test)]
|
||||||
fn test_simple_deserialize() {
|
mod tests {
|
||||||
const TEST_DATA: &str =
|
use super::*;
|
||||||
"([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])";
|
use crate::instructions::{
|
||||||
|
read::{SourceFormat, SourceType},
|
||||||
|
write::{TargetFormat, TargetType},
|
||||||
|
MathInstruction,
|
||||||
|
};
|
||||||
|
|
||||||
assert_eq!(
|
#[test]
|
||||||
from_ron(TEST_DATA),
|
fn test_simple_deserialize() {
|
||||||
Rpl(vec![
|
const TEST_DATA: &str =
|
||||||
Instruction::Read(instructions::read::Read {
|
"([Read( (source: File(\"~/example/file.png\"), format: Png) ),Math(Add),Write(( target: File(\"~/example/out.jpg\"), format: Jpeg))])";
|
||||||
source: SourceType::File("~/example/file.png".into()),
|
|
||||||
format: SourceFormat::Png
|
assert_eq!(
|
||||||
}),
|
from_ron(TEST_DATA),
|
||||||
Instruction::Math(MathInstruction::Add),
|
Rpl(vec![
|
||||||
Instruction::Write(instructions::write::Write {
|
Instruction::Read(instructions::read::Read {
|
||||||
target: TargetType::File("~/example/out.jpg".into()),
|
source: SourceType::File("~/example/file.png".into()),
|
||||||
format: TargetFormat::Jpeg
|
format: SourceFormat::Png
|
||||||
})
|
}),
|
||||||
])
|
Instruction::Math(MathInstruction::Add),
|
||||||
);
|
Instruction::Write(instructions::write::Write {
|
||||||
|
target: TargetType::File("~/example/out.jpg".into()),
|
||||||
|
format: TargetFormat::Jpeg
|
||||||
|
})
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
just nushell
|
just nushell
|
||||||
typst typst-lsp
|
typst typst-lsp
|
||||||
mold
|
mold
|
||||||
|
cargo-nextest
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
6
justfile
6
justfile
|
@ -1,3 +1,5 @@
|
||||||
|
all: test docs
|
||||||
|
|
||||||
# Compile all documentation as in proposals and design documents, placing them under `docs/compiled`.
|
# Compile all documentation as in proposals and design documents, placing them under `docs/compiled`.
|
||||||
docs:
|
docs:
|
||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
|
@ -9,3 +11,7 @@ docs:
|
||||||
)
|
)
|
||||||
mv $pdf docs/compiled
|
mv $pdf docs/compiled
|
||||||
} | ignore
|
} | ignore
|
||||||
|
|
||||||
|
test:
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
cargo nextest run
|
||||||
|
|
Loading…
Reference in a new issue