Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rakudo is numificationally inconsistent between Str and Match (and the spec is out-of-date) #1796

Closed
p6rt opened this issue May 30, 2010 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented May 30, 2010

Migrated from rt.perl.org#75456 (status was 'resolved')

Searchable as RT75456$

@p6rt
Copy link
Author

p6rt commented May 30, 2010

From @masak

<moritz_> rakudo​: '1 ' ~~ /.*/; say +$/
<p6eval> rakudo 1727ca​: OUTPUT«0␤»
<pmichaud> rakudo++
<moritz_> is that actually correct?
<moritz_> I don't believe it is
<masak> waitwait.
<masak> I'd expect '1' from that.
<moritz_> rakudo​: say +'1 '
<p6eval> rakudo 1727ca​: OUTPUT«1␤»
* masak submits rakudobug
<pmichaud> wait wait
<masak> moritz_++
<pmichaud> wait wait
<masak> :)
<pmichaud> seriously, wait
* masak waits
<pmichaud> your intuition doesn't match what TimToady++ told me once
during a concall
<pmichaud> we were going to change numification so that it had to
match exactly (although trailing spaces might've been allowed)
<pmichaud> rakudo​: say +"1 abc"
<p6eval> rakudo 1727ca​: OUTPUT«1␤»
<pmichaud> rakudo is wrong there
<moritz_> pmichaud​: and how would one numify while ignore trailing garbage?
<pmichaud> moritz_​: I don't know -- that was just what we discussed
<masak> I don't know that that update has even made it into the spec.
<moritz_> anyway, the current situation is incoherent in rakudo
<masak> yep. deserves a rakudobug.
<moritz_> +1
<pmichaud> no, the update never made it into the spec, afaik

@p6rt
Copy link
Author

p6rt commented Jun 5, 2010

@moritz - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jun 5, 2010
@p6rt
Copy link
Author

p6rt commented Jun 5, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/integration/real-strings.t

commit 9552cd839eafc433607391f7c53dd9a3939b2f51
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sat Jun 5 21​:40​:38 2010 +0000

  [t/spec] refudged real-strings.t for rakudo, and add test for RT #​75456 (numification of match objects with trailing space)
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31135 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/integration/real-strings.t b/t/spec/integration/real-strings.t
index 6a01298..a909cad 100644
--- a/t/spec/integration/real-strings.t
+++ b/t/spec/integration/real-strings.t
@@ -14,8 +14,9 @@ plan *;
        'basic sanity: .trans works with native Perl 6 strings';
 }
 
+#?rakudo skip 'borked'
 {
-    my $x = 'abc'.split(m/b/).[0];
+    my $x = 'abc'.split(/b/).[0];
     lives_ok {$x.trans(['a'] => ['b']) }, 
        'Still works with strings returned from split() (lives)';
     is $x.trans(['a'] => ['b']), 'b',
@@ -36,6 +37,7 @@ dies_ok { for "a b c".split(/\s/) -> $foo { $foo = $foo; } }, 'variables returne
 
 ok 1.Str ~~ / ^ 1 $ /, 'RT 66366; 1.Str is a "good" Str';
 
+#?rakudo 3 skip 'borked'
 is "helo".flip().trans("aeiou" => "AEIOU"), 'OlEh', '.flip.trans (RT 66300)';
 is "helo".flip.trans(("aeiou" => "AEIOU")), 'OlEh', '.flip.trans (RT 66300)';
 is "helo".lc.trans(("aeiou" => "AEIOU")),   'hElO', '.flip.trans (RT 66300)';
@@ -52,6 +54,7 @@ is "helo".lc.trans(("aeiou" => "AEIOU")),   'hElO', '.flip.trans (RT 66300)';
 
 # not a "real string', but a "real hash" bug found in Rakudo:
 
+#?rakudo skip 'borked'
 {
     my $x = 0;
     for %*VM.kv -> $k, $v { $x++};
@@ -64,6 +67,13 @@ is "helo".lc.trans(("aeiou" => "AEIOU")),   'hElO', '.flip.trans (RT 66300)';
     #?rakudo todo 'RT 67852'
     lives_ok { ('bit' ~& 'wise').trans() }, 'can .trans() on bitwise result';
 }
+
+# RT #75456 hilarity
+{
+    ok ('1 ' ~~ /.+/) && $/ eq '1 ', 'matching sanity';
+    ok +$/ == 1, 'numification of match objects with trailing whitespaces';
+
+}
 done_testing;
 
 # vim: ft=perl6

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant