a better coloring crate
fix {}
| -rw-r--r-- | Cargo.toml | 4 | ||||
| -rw-r--r-- | src/cfstr.rs | 5 | ||||
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | tests/basic.rs | 5 |
4 files changed, 13 insertions, 2 deletions
@@ -1,6 +1,6 @@ [package] name = "comat" -version = "0.1.0" +version = "0.1.1" edition = "2021" authors = ["bendn <[email protected]>"] license = "MIT" @@ -13,4 +13,4 @@ proc_macro = true [dependencies] proc-macro2 = "1.0.67" quote = "1.0.32" -syn = { version = "2.0.15", features = ["full"] } +syn = "2.0.15" diff --git a/src/cfstr.rs b/src/cfstr.rs index 96699ca..ef332db 100644 --- a/src/cfstr.rs +++ b/src/cfstr.rs @@ -72,6 +72,11 @@ impl Parse for CFStr { out.push('{'); continue; } + Some('}') => { + out.push('{'); + out.push('}'); + continue; + } Some(ch) => temp.push(ch), None => return Err(stream.error("unexpected eof")), } @@ -23,6 +23,7 @@ //! ``` //! vs //! ``` +//! # let thing = 0; //! print!("\x1b[0;34;31m{thing}\x1b[0m."); //! ``` //! vs diff --git a/tests/basic.rs b/tests/basic.rs index 594df32..37b809e 100644 --- a/tests/basic.rs +++ b/tests/basic.rs @@ -10,3 +10,8 @@ fn escapes() { assert_eq!(comat!("{{ow}} {{red}}"), "{ow} {red}"); assert_eq!(comat!("{{{{"), "{{"); } + +#[test] +fn take() { + assert_eq!(comat!("{}"), "{}"); +} |