Created
September 4, 2013 00:52
-
-
Save colomon/6431519 to your computer and use it in GitHub Desktop.
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
t/spec/S05-substitution/subst.rakudo.parrot .. | |
1..140 | |
ok 1 - We can use subst | |
ok 2 - .. withouth side effect | |
ok 3 - .. or using Str as pattern | |
ok 4 - .. with literal string matching | |
ok 5 - We can have a closure as replacement | |
ok 6 - .. and with the .= modifier | |
ok 7 - .. it changes the receiver | |
use of uninitialized value of type Any in string context in block at t/spec/S05-substitution/subst.rakudo.parrot:24 | |
use of uninitialized value of type Any in string context in block at t/spec/S05-substitution/subst.rakudo.parrot:24 | |
ok 8 - .. and it can not access captures from strings | |
ok 9 - .. you must wrap it in a closure | |
ok 10 - .. and do nifty things in closures | |
ok 11 - "a".subst("a", "b") is "b" | |
ok 12 - $/ is left untouched | |
ok 13 - "a".subst(/a/, "b") is "b" | |
ok 14 - $/ matched "a" | |
ok 15 - "a".subst(/x/, "y") is "a" | |
ok 16 - $/ is a falsey | |
ok 17 - $_ = "a"; s/a/b/ is "b" | |
ok 18 - $/ matched "a" | |
ok 19 - $_ = "a"; s/x/y/ is "a" | |
ok 20 - $/ is a falsey | |
ok 21 - .subst and :g | |
ok 22 - .subst and :global | |
ok 23 - .subst and :x(0) | |
ok 24 - .subst and :x(1) | |
ok 25 - .subst and :x(2) | |
ok 26 - .subst and :x(3) | |
ok 27 - .subst and :x(4) | |
ok 28 - .subst and :x(5) | |
ok 29 - .subst and :x(*) | |
ok 30 - .subst and :x(0..1) | |
ok 31 - .subst and :x(0..3) | |
ok 32 - .subst and :x(3..5) | |
ok 33 - .subst and :x(5..6) | |
ok 34 - .subst and :x(3..2) | |
ok 35 - .subst (str pattern) and :g | |
ok 36 - .subst (str pattern) and :x(0) | |
ok 37 - .subst (str pattern) and :x(1) | |
ok 38 - .subst (str pattern) and :x(2) | |
ok 39 - .subst (str pattern) and :x(3) | |
ok 40 - .subst (str pattern) and :x(4) | |
ok 41 - .subst (str pattern) and :x(5) | |
ok 42 - .subst (str pattern) and :x(*) | |
ok 43 - .subst (str pattern) and :x(0..1) | |
ok 44 - .subst (str pattern) and :x(0..3) | |
ok 45 - .subst (str pattern) and :x(3..5) | |
ok 46 - .subst (str pattern) and :x(5..6) | |
ok 47 - .subst (str pattern) and :x(3..2) | |
ok 48 - .subst and :nth(0) | |
ok 49 - .subst and :nth(1) | |
ok 50 - .subst and :nth(2) | |
ok 51 - .subst and :nth(3) | |
ok 52 - .subst and :nth(4) | |
ok 53 - .subst and :nth(5) | |
ok 54 - .subst (str pattern) and :nth(0) | |
ok 55 - .subst (str pattern) and :nth(1) | |
ok 56 - .subst (str pattern) and :nth(2) | |
ok 57 - .subst (str pattern) and :nth(3) | |
ok 58 - .subst (str pattern) and :nth(4) | |
ok 59 - .subst (str pattern) and :nth(5) | |
ok 60 - .subst with :nth(1,2,3,4)) and :x(3) | |
ok 61 - .subst with :nth(2,4,6,8) and :x(2) | |
ok 62 - .subst with :nth(2) and :x(3) | |
ok 63 - .subst with :p(0) | |
ok 64 - .subst with :p(1) | |
ok 65 - .subst with :p(2) | |
ok 66 - .subst with :p(0) and :g | |
ok 67 - .subst with :p(1) and :g | |
ok 68 - .subst with :p(2) and :g | |
ok 69 - .subst with :c(0) | |
ok 70 - .subst with :c(1) | |
ok 71 - .subst with :c(2) | |
ok 72 - .subst with :c(0) and :g | |
ok 73 - .subst with :c(1) and :g | |
ok 74 - .subst with :c(2) and :g | |
ok 75 - .subst with :c(0) and :nth(3, 4) | |
ok 76 - .subst with :c(1) and :nth(3, 4) | |
ok 77 - .subst with :c(2) and :nth(3, 4) | |
ok 78 - Constant substitution | |
ok 79 - Scalar substitution | |
ok 80 - List substitution | |
ok 81 - can't modify string literal (only variables) | |
ok 82 - successful substitution returns True | |
ok 83 - ss/.../.../ preserves whitespace | |
ok 84 - Cannot ss/// string literal | |
ok 85 - s[...] = ... returns true on success | |
ok 86 - substitution worked | |
ok 87 - s[...] = ... returns false on failure | |
ok 88 - failed substitutions leaves string unchanged | |
ok 89 - s/// dies on unknown adverb | |
ok 90 - :overlap does not make sense on s/// | |
ok 91 - s[...] = ... returns true on success | |
ok 92 - substitution worked | |
ok 93 - failed substitutions leaves string unchanged | |
ok 94 - s:g[..] = returns True | |
ok 95 - and the substition worked | |
ok 96 - can use $/ on the RHS | |
ok 97 - can use $0 on the RHS | |
ok 98 - s:g[...] and captures work together well | |
ok 99 - s:x(2) | |
ok 100 - s:1st return value | |
ok 101 - s:1st side effect | |
ok 102 - s:2nd return value | |
ok 103 - s:2nd side effect | |
ok 104 - s:3rd return value | |
ok 105 - s:3rd side effect | |
ok 106 - s:4th return value | |
ok 107 - s:4th side effect | |
ok 108 - s:nth(5) return value | |
ok 109 - s:nth(5) side effect | |
ok 110 - s:nth(6) return value | |
ok 111 - s:nth(6) no side effect | |
ok 112 - s:x(2):nth(1,3) works in combination | |
ok 113 - s:2x:nth(1,3) works in combination | |
ok 114 - ! separator | |
ok 115 - # SKIP s[...] op= RHS | |
ok 116 - # SKIP s[...] op= RHS | |
ok 117 - # SKIP s[...] op= RHS | |
ok 118 - # SKIP s:g[...] = | |
ok 119 - # SKIP s:g[...] = | |
ok 120 - bare s is always substititution | |
ok 121 - can call sub s as "s()" | |
ok 122 - bare s is substitution before whitespace then parens | |
ok 123 - .substr and :samecase (1) | |
ok 124 - .substr and :samecase (2) | |
ok 125 - .substr (string pattern) and : samecase (1) | |
ok 126 - .substr (string pattern) and : samecase (2) | |
ok 127 - .substr (string pattern) and :g and :samecase (1) | |
ok 128 - .substr (string pattern) and :g and :samecase (2) | |
ok 129 - .substr and samecase, worked with block replacement | |
ok 130 - .substr and :g and :samecase, worked with block replacement | |
ok 131 - :ii implies :i | |
ok 132 - :samecase implies :i | |
ok 133 - Zero-width substitution does not make the GC recurse | |
ok 134 - Value of :i must be known at compile time | |
not ok 135 - :i(1) is OK# TODO be smarter about constant detection | |
# Error: Adverb i value must be known at compile time | |
ok 136 - can use $0 in RHS of s/// | |
ok 137 - (sanely) dies when trying to s/// a read-only variable | |
ok 138 - s[f] is parsed as a substitution op | |
ok 139 - '$_ = "foo"; s[] = "bar";' died | |
ok 140 - right exception type (X::Syntax::Regex::NullRegex) | |
# FUDGED! | |
ok | |
All tests successful. | |
Files=1, Tests=140, 7 wallclock secs ( 0.03 usr 0.00 sys + 6.84 cusr 0.46 csys = 7.33 CPU) | |
Result: PASS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment