use v6-alpha; use Test; =kwid regex r { | x } "x" ~~ /$/ should match "x", not "". =cut plan 20; unless "a" ~~ rx/a/ { skip_rest "skipped tests - rule support appears to be missing"; exit; } # rule r { | x } - XXX 'rule' doesn't backtrack regex r { | x } ok "" ~~ //, '"" ~~ // matched'; is $/, "", 'with ""'; is $/.from, 0, 'from 0'; is $/.to, 0, 'to 0'; ok "x" ~~ //, '"x" ~~ // matched'; is $/, "", 'with ""'; is $/.from, 0, 'from 0'; is $/.to, 0, 'to 0'; skip_rest 'infinite loop in PCR - XXX fix this before release!'; exit; ok "x" ~~ /$/, '"x" ~~ /$/ matched'; is $/, "x", 'with "x"'; is $/.from, 0, 'from 0'; is $/.to, 1, 'to 1'; ok "xx" ~~ /$/, '"xx" ~~ /$/ matched'; is $/, "xx", 'with "xx"'; is $/.from, 0, 'from 0'; is $/.to, 2, 'to 2'; # rule r2 { | x } regex r2 { | x } ok "x" ~~ /$/, '"x" ~~ /$/ matched'; is $/, "x", 'with "x"'; is $/.from, 0, 'from 0'; is $/.to, 1, 'to 1';