X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftest%2Frun-pass%2Fmacro-at-most-once-rep.rs;h=c08effe549328705ae5843475b2c4f54c5032033;hb=b2ed17b5ea8d300838138844e3b2701cf000eae2;hp=b7e942f938321ae8f033a65909cea38975d856e2;hpb=56714acc5eb0687ed9a7566fdebe5528657fc5b3;p=rust.git diff --git a/src/test/run-pass/macro-at-most-once-rep.rs b/src/test/run-pass/macro-at-most-once-rep.rs index b7e942f9383..c08effe5493 100644 --- a/src/test/run-pass/macro-at-most-once-rep.rs +++ b/src/test/run-pass/macro-at-most-once-rep.rs @@ -32,25 +32,13 @@ macro_rules! foo { } } } -macro_rules! baz { - ($($a:ident),? ; $num:expr) => { { // comma separator is meaningless for `?` - let mut x = 0; - - $( - x += $a; - )? - - assert_eq!(x, $num); - } } -} - macro_rules! barplus { ($($a:ident)?+ ; $num:expr) => { { let mut x = 0; $( x += $a; - )+ + )? assert_eq!(x, $num); } } @@ -62,7 +50,7 @@ macro_rules! barstar { $( x += $a; - )* + )? assert_eq!(x, $num); } } @@ -74,15 +62,10 @@ pub fn main() { // accept 0 or 1 repetitions foo!( ; 0); foo!(a ; 1); - baz!( ; 0); - baz!(a ; 1); // Make sure using ? as a separator works as before - barplus!(a ; 1); - barplus!(a?a ; 2); - barplus!(a?a?a ; 3); - barstar!( ; 0); - barstar!(a ; 1); - barstar!(a?a ; 2); - barstar!(a?a?a ; 3); + barplus!(+ ; 0); + barplus!(a + ; 1); + barstar!(* ; 0); + barstar!(a * ; 1); }