Skip to content

Commit

Permalink
Add bad template width test
Browse files Browse the repository at this point in the history
  • Loading branch information
merehap committed Oct 19, 2024
1 parent ea0c3e6 commit cd272c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ use crate::r#type::{Type, Precision};

// TODO:
// * Put compile checks behind different target so compiler updates don't break building.
// * Incorrect template size test.
// * Move macro bases to their own files.
// After 0.1.0:
// * Create abstract syntax trees instead of quoting prematurely.
// ** Add comments that show example macro expansion fragments.
Expand Down
6 changes: 6 additions & 0 deletions tests/compile_failures/splitbits_bad_template_width.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use splitbits::splitbits;

fn main() {
let input = 5;
splitbits!(input, "aaaabbb");
}
7 changes: 7 additions & 0 deletions tests/compile_failures/splitbits_bad_template_width.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
error: proc macro panicked
--> tests/compile_failures/splitbits_bad_template_width.rs:5:5
|
5 | splitbits!(input, "aaaabbb");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: message: Template must have a valid width: "Template width must be 8, 16, 32, 64, or 128, but was 7."

0 comments on commit cd272c2

Please sign in to comment.