forked from eclipse-zenoh/zenoh
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formatter reuse and fix issue with ** sometimes being considered …
…as included into * (eclipse-zenoh#638) Co-authored-by: Pierre Avital <[email protected]>
- Loading branch information
1 parent
cc500d5
commit 4b1a59f
Showing
3 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#[test] | ||
fn reuse() { | ||
zenoh::kedefine!( | ||
pub gkeys: "zenoh/${group:*}/${member:*}", | ||
); | ||
let mut formatter = gkeys::formatter(); | ||
let k1 = zenoh::keformat!(formatter, group = "foo", member = "bar").unwrap(); | ||
assert_eq!(dbg!(k1).as_str(), "zenoh/foo/bar"); | ||
|
||
formatter.set("member", "*").unwrap(); | ||
let k2 = formatter.build().unwrap(); | ||
assert_eq!(dbg!(k2).as_str(), "zenoh/foo/*"); | ||
|
||
dbg!(&mut formatter).group("foo").unwrap(); | ||
dbg!(&mut formatter).member("*").unwrap(); | ||
let k2 = dbg!(&mut formatter).build().unwrap(); | ||
assert_eq!(dbg!(k2).as_str(), "zenoh/foo/*"); | ||
|
||
let k3 = zenoh::keformat!(formatter, group = "foo", member = "*").unwrap(); | ||
assert_eq!(dbg!(k3).as_str(), "zenoh/foo/*"); | ||
|
||
zenoh::keformat!(formatter, group = "**", member = "**").unwrap_err(); | ||
} |