Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[t/spec] work on context-forcers.t: use stricter comparison; test tha…

…t Int.Str returns STr

git-svn-id: http://svn.pugscode.org/pugs@29995 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 68c6a43303c29cfefe24b6b196e76c46dc5351a3 1 parent f42ca42
moritz authored
7 S02-builtin_data_types/array.t
@@ -2,7 +2,7 @@ use v6;
2 2
3 3 use Test;
4 4
5   -plan 94;
  5 +plan 95;
6 6
7 7 #L<S02/Mutable types/Array>
8 8
@@ -26,6 +26,11 @@ plan 94;
26 26 is $i, 1, 'for [1, 2, 3] does one iteration';
27 27 }
28 28
  29 +# uninitialized array variables should work too...
  30 +{
  31 + my @a;
  32 + is eval(@a.perl).elems, 0, '@a.perl on uninitialized variable';
  33 +}
29 34
30 35 # array of strings
31 36
55 S03-operators/context-forcers.t
@@ -2,36 +2,45 @@ use v6;
2 2
3 3 use Test;
4 4
5   -plan 93;
  5 +plan 94;
  6 +
  7 +#?DOES 1
  8 +sub iis(Mu $a, Mu $b, $descr) {
  9 + unless ok($a === $b, $descr) {
  10 + diag "Got: " ~ $a.perl;
  11 + diag "Expected: " ~ $b.perl;
  12 + }
  13 +
  14 +}
6 15
7 16 { # L<S03/"Changes to Perl 5 operators"/imposes boolean context/>
8   - is ?True, True, "? context forcer works (1)";
9   - is ?False, False, "? context forcer works (2)";
  17 + iis ?True, True, "? context forcer works (1)";
  18 + iis ?False, False, "? context forcer works (2)";
10 19
11   - is ?1, True, "? context forcer works (3)";
12   - is ?0, False, "? context forcer works (4)";
13   - is ?(?1), True, "? context forcer works (5)";
14   - is ?(?0), False, "? context forcer works (6)";
  20 + iis ?1, True, "? context forcer works (3)";
  21 + iis ?0, False, "? context forcer works (4)";
  22 + iis ?(?1), True, "? context forcer works (5)";
  23 + iis ?(?0), False, "? context forcer works (6)";
15 24
16   - is ?"hi", True, "? context forcer works (7)";
17   - is ?"", False, "? context forcer works (8)";
18   - is ?(?"hi"), True, "? context forcer works (9)";
19   - is ?(?""), False, "? context forcer works (10)";
  25 + iis ?"hi", True, "? context forcer works (7)";
  26 + iis ?"", False, "? context forcer works (8)";
  27 + iis ?(?"hi"), True, "? context forcer works (9)";
  28 + iis ?(?""), False, "? context forcer works (10)";
20 29
21   - is ?"3", True, "? context forcer works (11)";
22   - is ?"0", False, "? context forcer works (12)";
23   - is ?(?"3"), True, "? context forcer works (13)";
24   - is ?(?"0"), False, "? context forcer works (14)";
  30 + iis ?"3", True, "? context forcer works (11)";
  31 + iis ?"0", False, "? context forcer works (12)";
  32 + iis ?(?"3"), True, "? context forcer works (13)";
  33 + iis ?(?"0"), False, "? context forcer works (14)";
25 34
26   - is ?Mu, False, "? context forcer works (15)";
  35 + iis ?Mu, False, "? context forcer works (15)";
27 36 }
28 37 { # L<S02/"Names and Variables" /In boolean contexts/>
29   - is ?[], False, "? context forcer: empty container is false";
30   - is ?[1], True, "? context forcer: non-empty container is true";
  38 + iis ?[], False, "? context forcer: empty container is false";
  39 + iis ?[1], True, "? context forcer: non-empty container is true";
31 40 }
32 41 { # L<SO2/"Names and Variables" /In a boolean context, a Hash/>
33   - is ?{}, False, "? context forcer: empty hash is false";
34   - is ?{:a}, True, "? context forcer: non-empty hash is true";
  42 + iis ?{}, False, "? context forcer: empty hash is false";
  43 + iis ?{:a}, True, "? context forcer: non-empty hash is true";
35 44 }
36 45
37 46 { # L<S03/"Changes to Perl 5 operators" /imposes a numeric context/>
@@ -40,6 +49,7 @@ plan 93;
40 49 is +"1", 1, "+ context forcer works (3)";
41 50 is +"0", 0, "+ context forcer works (4)";
42 51 is +"", 0, "+ context forcer works (5)";
  52 + #?rakudo skip 'numeification of Mu'
43 53 is +Mu, 0, "+ context forcer works (6)";
44 54 is +"Inf", Inf, "+ context forcer works (7)";
45 55 is +"-Inf", -Inf, "+ context forcer works (8)";
@@ -55,6 +65,7 @@ plan 93;
55 65 is ~"1", "1", "~ context forcer works (3)";
56 66 is ~"0", "0", "~ context forcer works (4)";
57 67 is ~"", "", "~ context forcer works (5)";
  68 + #?rakudo skip '~Mu'
58 69 is ~Mu, "", "~ context forcer works (6)";
59 70 is ~"Inf", "Inf", "~ context forcer works (7)";
60 71 is ~"-Inf", "-Inf", "~ context forcer works (8)";
@@ -62,6 +73,8 @@ plan 93;
62 73 is ~"3e5", "3e5", "~ context forcer works (10)";
63 74 }
64 75
  76 +ok 4.Str ~~ Str, 'Int.Str returns a Str';
  77 +
65 78 sub eval_elsewhere($code){ eval($code) }
66 79
67 80 # L<S02/Context/numeric "+">
@@ -195,6 +208,7 @@ sub eval_elsewhere($code){ eval($code) }
195 208 {
196 209 ok 0 ~~ ^10, '0 is in ^10';
197 210 ok 9 ~~ ^10, '9 is in ^10';
  211 + #?rakudo 3 skip '^$num ranges'
198 212 ok 9.9 ~~ ^10, '9.99 is in ^10';
199 213 ok 10 !~~ ^10, '10 is not in ^10';
200 214 is (^10).elems, 10, '^10 has 10 elems';
@@ -207,6 +221,7 @@ sub eval_elsewhere($code){ eval($code) }
207 221 ok 0 ~~ ^@a, '0 is in ^10';
208 222 ok 9 ~~ ^@a, '9 is in ^10';
209 223 ok 9.9 ~~ ^@a, '9.99 is in ^10';
  224 + #?rakudo 2 skip '^$num ranges'
210 225 ok 10 !~~ ^@a, '10 is not in ^10';
211 226 is (^@a).elems, 10, '^10 has 10 elems';
212 227 isa_ok ^@a, Range;

0 comments on commit 68c6a43

Please sign in to comment.
Something went wrong with that request. Please try again.