File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1
1
# while, until statements
2
2
3
- plan (16 );
3
+ plan (20 );
4
4
5
5
my $ a ; my $ sum ;
6
6
@@ -105,3 +105,26 @@ while $str -> $got {
105
105
is ($ got , ' hello there' , ' regression test for a bug in type conversion' );
106
106
$ str := ' ' ;
107
107
}
108
+
109
+ my $ x := 0 ;
110
+ repeat until $ x >= 2 -> $ another_x {
111
+ if $ x == 0 {
112
+ ok (nqp ::isnull($ another_x ), ' repeat until -> get null before condition' );
113
+ } else {
114
+ is ($ another_x , 0 , ' repeat until -> gets condition' );
115
+ }
116
+ $ x := $ x + 1 ;
117
+ }
118
+
119
+ sub cond ($ y ) {
120
+ $ y == 1 ?? 100 !! 0 ;
121
+ }
122
+ my $ y := 0 ;
123
+ repeat while cond($ y ) -> $ cond {
124
+ if $ y == 0 {
125
+ ok (nqp ::isnull($ cond ), ' repeat while -> get null before condition' );
126
+ } else {
127
+ is ($ cond , 100 , ' repeat while -> gets condition' );
128
+ }
129
+ $ y := $ y + 1 ;
130
+ }
You can’t perform that action at this time.
0 commit comments