diff --git a/tests/compile-tests/fail/odd-capacity/Cargo.toml b/tests/compile-tests/fail/odd-capacity/Cargo.toml new file mode 100644 index 0000000..48bf89f --- /dev/null +++ b/tests/compile-tests/fail/odd-capacity/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "odd-capacity" +version = "0.1.0" +edition = "2021" +rust-version = "1.63.0" + +[workspace] + +[dependencies] +hex = { package = "hex-conservative", path = "../../../../" } diff --git a/tests/compile-tests/fail/odd-capacity/src/main.rs b/tests/compile-tests/fail/odd-capacity/src/main.rs new file mode 100644 index 0000000..4624b6b --- /dev/null +++ b/tests/compile-tests/fail/odd-capacity/src/main.rs @@ -0,0 +1,6 @@ +use hex::buf_encoder::BufEncoder; +use hex::Case; + +// This should fail to compile because the capacity size is odd. +// The only difference to `even-capacity` is the capacity size. +fn main() { let _encoder = BufEncoder::<3>::new(Case::Lower); } diff --git a/tests/compile-tests/pass/even-capacity/Cargo.toml b/tests/compile-tests/pass/even-capacity/Cargo.toml new file mode 100644 index 0000000..d378dda --- /dev/null +++ b/tests/compile-tests/pass/even-capacity/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "even-capacity" +version = "0.1.0" +edition = "2021" +rust-version = "1.63.0" + +[workspace] + +[dependencies] +hex = { package = "hex-conservative", path = "../../../../" } diff --git a/tests/compile-tests/pass/even-capacity/src/main.rs b/tests/compile-tests/pass/even-capacity/src/main.rs new file mode 100644 index 0000000..f22133c --- /dev/null +++ b/tests/compile-tests/pass/even-capacity/src/main.rs @@ -0,0 +1,5 @@ +use hex::buf_encoder::BufEncoder; +use hex::Case; + +// This should compile, ensuring that the compile error in odd-capacity is from the odd capacity. +fn main() { let _encoder = BufEncoder::<4>::new(Case::Lower); }