Skip to content

Commit b43abf2

Browse files
committed
More unicode love
1 parent 98d81bb commit b43abf2

File tree

10 files changed

+38
-38
lines changed

10 files changed

+38
-38
lines changed

Benchable.p6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ multi method benchmark-code($full-commit, $filename) {
4343
my %stats;
4444
for ^ITERATIONS {
4545
my $result = self.run-snippet: $full-commit, $filename;
46-
if $result<exit-code> != 0 {
46+
if $result<exit-code> 0 {
4747
%stats<err> = «run failed, exit code = $result<exit-code>, exit signal = $result<signal>»;
4848
return %stats
4949
}
@@ -65,7 +65,7 @@ multi method benchmark-code($full-commit-hash, @code) {
6565

6666
# lock on the destination directory to make
6767
# sure that other bots will not get in our way.
68-
while run(mkdir, --, {BUILDS-LOCATION}/rakudo-moar/$full-commit-hash).exitcode != 0 {
68+
while run(mkdir, --, {BUILDS-LOCATION}/rakudo-moar/$full-commit-hash).exitcode 0 {
6969
sleep 0.5;
7070
# Uh, wait! Does it mean that at the same time we can use only one
7171
# specific build? Yes, and you will have to wait until another bot
@@ -159,7 +159,7 @@ Z: loop (my $x = 0; $x < @commits - 1; $x++) {
159159

160160
next unless %times{@commits[$x]}:exists and %times{@commits[$x + 1]}:exists; # the commits have to have been run at all
161161
next if %times{@commits[$x]}<err>:exists or %times{@commits[$x + 1]}<err>:exists; # and without error
162-
if abs(%times{@commits[$x]}<min> - %times{@commits[$x + 1]}<min>) >= %times{@commits[$x]}<min> × 0.1 {
162+
if abs(%times{@commits[$x]}<min> - %times{@commits[$x + 1]}<min>) %times{@commits[$x]}<min> × 0.1 {
163163
my $result = self.get-output: git, rev-list, --bisect, --no-merges, @commits[$x] ~ ^.. ~ @commits[$x + 1];
164164
my $new-commit = $result<output>;
165165
if $result<exit-code> == 0 and defined $new-commit and $new-commit ne {
@@ -178,7 +178,7 @@ Z: loop (my $x = 0; $x < @commits - 1; $x++) {
178178

179179
@commits .= map: { self.get-short-commit: $_ };
180180

181-
if @commits >= ITERATIONS {
181+
if @commits ITERATIONS {
182182
my $pfilename = plot.svg;
183183
my $title = $config $code.trans: " => \";
184184
my @valid-commits = @commits.grep: { %times{$_}<err>:!exists };

Bisectable.p6

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ method run-bisect($code-file, *%_ (:$old-exit-code, :$old-exit-signal, :$old-out
4646
my $result = self.get-output: git, bisect, $revision-type.lc;
4747
$status = $result<exit-code>;
4848
last if $result<output> ~~ /^^ \S+ ‘ is the first new commit’ /; # TODO just return this
49-
last if $result<exit-code> != 0;
49+
last if $result<exit-code> 0;
5050
LAST take $result<output>
5151
}
5252
return @bisect-log.join(\n), $status
@@ -89,7 +89,7 @@ method test-commit($code-file, :$old-exit-code, :$old-exit-signal, :$old-output)
8989
with $old-exit-signal {
9090
take »»»»» Bisecting by exit signal;
9191
take »»»»» Current exit signal is {signal-to-text $result<signal>}, exit signal on “old” revision is {signal-to-text $old-exit-signal};
92-
if $old-exit-signal != 0 {
92+
if $old-exit-signal 0 {
9393
take »»»»» Note that on “old” revision exit signal is normally {signal-to-text 0}, you are probably trying to find when something was fixed
9494
}
9595
take »»»»» If exit signal is not the same as on “old” revision, this revision will be marked as “new”;
@@ -102,7 +102,7 @@ method test-commit($code-file, :$old-exit-code, :$old-exit-signal, :$old-output)
102102
with $old-exit-code {
103103
take »»»»» Bisecting by exit code;
104104
take »»»»» Current exit code is $result<exit-code>, exit code on “old” revision is $old-exit-code;
105-
if $old-exit-code != 0 {
105+
if $old-exit-code 0 {
106106
take »»»»» Note that on “old” revision exit code is normally 0, you are probably trying to find when something was fixed
107107
}
108108
take »»»»» If exit code is not the same as on “old” revision, this revision will be marked as “new”;
@@ -201,7 +201,7 @@ method process($msg, $code is copy, $old, $new) {
201201
if $old-result<exit-code> == $new-result<exit-code>
202202
and $old-result<signal> == $new-result<signal>
203203
and $old-result<output> eq $new-result<output> {
204-
if $old-result<signal> != 0 {
204+
if $old-result<signal> 0 {
205205
$msg.reply: On both starting points (old=$short-old new=$short-new) the exit code is $old-result<exit-code>, exit signal is {signal-to-text $old-result<signal>} and the output is identical as well
206206
} else {
207207
$msg.reply: On both starting points (old=$short-old new=$short-new) the exit code is $old-result<exit-code> and the output is identical as well
@@ -215,29 +215,29 @@ method process($msg, $code is copy, $old, $new) {
215215

216216
my $bisect-start = self.get-output: git, bisect, start;
217217
my $bisect-old = self.get-output: git, bisect, old, $full-old;
218-
if $bisect-start<exit-code> != 0 and $bisect-old<exit-code> != 0 {
218+
if $bisect-start<exit-code> 0 and $bisect-old<exit-code> 0 {
219219
self.beg-for-help: $msg;
220-
return Failed to run 「bisect start」 if $bisect-start<exit-code> != 0;
221-
return Failed to run 「bisect old …”」 if $bisect-old<exit-code> != 0
220+
return Failed to run 「bisect start」 if $bisect-start<exit-code> 0;
221+
return Failed to run 「bisect old …”」 if $bisect-old<exit-code> 0
222222
}
223223

224224
my $init-result = self.get-output: git, bisect, new, $full-new;
225-
if $init-result<exit-code> != 0 {
225+
if $init-result<exit-code> 0 {
226226
$msg.reply: bisect log: ~ self.upload: { query => $msg.text,
227227
result => colorstrip($init-result<output>), },
228228
description => $msg.server.current-nick,
229229
public => !%*ENV<DEBUGGABLE>;
230230
return bisect init failure. See the log for more details
231231
}
232232
my ($bisect-output, $bisect-status);
233-
if $old-result<signal> != $new-result<signal> {
233+
if $old-result<signal> $new-result<signal> {
234234
$msg.reply: Bisecting by exit signal (old=$short-old new=$short-new). Old exit signal: {signal-to-text $old-result<signal>};
235235
($bisect-output, $bisect-status) = self.run-bisect: $filename, :old-exit-signal($old-result<signal>)
236-
} elsif $old-result<exit-code> != $new-result<exit-code> {
236+
} elsif $old-result<exit-code> $new-result<exit-code> {
237237
$msg.reply: Bisecting by exit code (old=$short-old new=$short-new). Old exit code: $old-result<exit-code>;
238238
($bisect-output, $bisect-status) = self.run-bisect: $filename, :old-exit-code($old-result<exit-code>)
239239
} else {
240-
if $old-result<signal> != 0 {
240+
if $old-result<signal> 0 {
241241
$msg.reply: Bisecting by output (old=$short-old new=$short-new) because on both starting points the exit code is $old-result<exit-code> and exit signal is {signal-to-text $old-result<signal>}
242242
} else {
243243
$msg.reply: Bisecting by output (old=$short-old new=$short-new) because on both starting points the exit code is $old-result<exit-code>
@@ -253,7 +253,7 @@ method process($msg, $code is copy, $old, $new) {
253253
my $good-revs = self.get-output(git, for-each-ref, --format=%(objectname), refs/bisect/old-*)<output>;
254254
my @possible-revs = self.get-output(git, rev-list, refs/bisect/new, --not, |$good-revs.lines)<output>.lines;
255255
return There are {+@possible-revs} candidates for the first “new” revision. See the log for more details
256-
} elsif $bisect-status != 0 {
256+
} elsif $bisect-status 0 {
257257
return ‘bisect run’ failure. See the log for more details
258258
} else {
259259
my $link-msg = self.get-output(git, show, --quiet, --date=short,

Committable.p6

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ method process($msg, $config is copy, $code is copy) {
8787
if $result<signal> < 0 { # numbers less than zero indicate other weird failures
8888
$output = Cannot test this commit ($output)
8989
} else {
90-
$output ~= «exit code = $result<exit-code>» if $result<exit-code> != 0;
91-
$output ~= «exit signal = {Signal($result<signal>)} ($result<signal>)» if $result<signal> != 0
90+
$output ~= «exit code = $result<exit-code>» if $result<exit-code> 0;
91+
$output ~= «exit signal = {Signal($result<signal>)} ($result<signal>)» if $result<signal> 0
9292
}
9393
}
9494
my $short-commit = self.get-short-commit: $commit;

Evalable.p6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ method process($message, $code is copy) {
7979
if $result<signal> < 0 { # numbers less than zero indicate other weird failures
8080
$output = Cannot test $full-commit ($result<output>)
8181
} else {
82-
$extra ~= (exit code $result<exit-code>) if $result<exit-code> != 0;
83-
$extra ~= (signal {Signal($result<signal>)}) if $result<signal> != 0
82+
$extra ~= (exit code $result<exit-code>) if $result<exit-code> 0;
83+
$extra ~= (signal {Signal($result<signal>)}) if $result<signal> 0
8484
}
8585
}
8686

8787
my $reply-start = rakudo-moar $short-commit: OUTPUT: «$extra;
8888
my $reply-end = »;
89-
if MESSAGE-LIMIT >= ($reply-start, $output, $reply-end).map(*.encode.elems).sum {
89+
if MESSAGE-LIMIT ($reply-start, $output, $reply-end).map(*.encode.elems).sum {
9090
return $reply-start ~ $output ~ $reply-end
9191
}
9292
my $link = self.upload: {result => ($extra$extra\n) ~ colorstrip($output),

Misc.pm6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ role PrettyLink { has &.link-msg }
2626
role FileStore { has %.additional-files }
2727

2828
sub shorten($str, $max, $cutoff=$max ÷ 2) is export {
29-
$max >= $str.chars$str$str.substr(0, $cutoff - 1) ~
29+
$max $str.chars$str$str.substr(0, $cutoff - 1) ~
3030
}
3131

3232
sub fuzzy-nick($nick, $distance) is export {

Unicodable.p6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ method process($msg, $query is copy) {
126126
$output = Something went wrong ($output);
127127
return $output
128128
} else {
129-
$output ~= «exit code = $result<exit-code>» if $result<exit-code> != 0;
130-
$output ~= «exit signal = {Signal($result<signal>)} ($result<signal>)» if $result<signal> != 0;
131-
return $output if $result<exit> != 0 or $result<signal> != 0
129+
$output ~= «exit code = $result<exit-code>» if $result<exit-code> 0;
130+
$output ~= «exit signal = {Signal($result<signal>)} ($result<signal>)» if $result<signal> 0;
131+
return $output if $result<exit> 0 or $result<signal> 0
132132
}
133133
}
134134
if $output {

Whateverable.pm6

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ method get-similar($tag-or-hash, @other?) {
143143

144144
# flat(@options, @tags, @commits).min: { sift4($_, $tag-or-hash, 5, 8) }
145145
my $ans = HEAD;
146-
my $ans_min = Inf;
146+
my $ans_min = ;
147147

148148
for flat @options, @tags, @commits {
149149
my $dist = sift4 $_, $tag-or-hash, $cutoff;
@@ -160,7 +160,7 @@ method run-smth($full-commit-hash, $code, :$backend=‘rakudo-moar’) {
160160
my $archive-path = {ARCHIVES-LOCATION}/$backend/$full-commit-hash.zst;
161161
# lock on the destination directory to make
162162
# sure that other bots will not get in our way.
163-
while run(mkdir, --, $build-path).exitcode != 0 {
163+
while run(mkdir, --, $build-path).exitcode 0 {
164164
sleep 0.5;
165165
# Uh, wait! Does it mean that at the same time we can use only one
166166
# specific build? Yes, and you will have to wait until another bot
@@ -203,14 +203,14 @@ method get-commits($config) {
203203
@commits = $config.split: ,;
204204
} elsif $config ~~ /^ $<start>=\S+ ‘..’ $<end>=\S+ $/ {
205205
chdir RAKUDO; # goes back in LEAVE
206-
if run(:out(Nil), git, rev-parse, --verify, $<start>).exitcode != 0 {
206+
if run(:out(Nil), git, rev-parse, --verify, $<start>).exitcode 0 {
207207
return Bad start, cannot find a commit for “$<start>”;
208208
}
209-
if run(:out(Nil), git, rev-parse, --verify, $<end>).exitcode != 0 {
209+
if run(:out(Nil), git, rev-parse, --verify, $<end>).exitcode 0 {
210210
return Bad end, cannot find a commit for “$<end>”;
211211
}
212212
my $result = self.get-output: git, rev-list, $<start>^..$<end>; # TODO unfiltered input
213-
return Couldn't find anything in the range if $result<exit-code> != 0;
213+
return Couldn't find anything in the range if $result<exit-code> 0;
214214
@commits = $result<output>.lines;
215215
my $num-commits = @commits.elems;
216216
return Too many commits ($num-commits) in range, you're only allowed {COMMITS-LIMIT} if $num-commits > COMMITS-LIMIT
@@ -250,12 +250,12 @@ method to-full-commit($commit, :$short = False) {
250250
chdir RAKUDO;
251251
LEAVE chdir $old-dir;
252252

253-
return if run(:out(Nil), git, rev-parse, --verify, $commit).exitcode != 0; # make sure that $commit is valid
253+
return if run(:out(Nil), git, rev-parse, --verify, $commit).exitcode 0; # make sure that $commit is valid
254254

255255
my $result = self.get-output: |(git, rev-list, -1, # use rev-list to handle tags
256256
($short--abbrev-commit ‼ Empty), $commit);
257257

258-
return if $result<exit-code> != 0;
258+
return if $result<exit-code> 0;
259259
return unless $result<output>;
260260
$result<output>
261261
}

t/benchable.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ $t.test(‘specific commit’,
9090
$t.test(the benchmark time makes sense,
9191
bench: HEAD sleep 2,
9292
/^ <me($t)>‘, starting to benchmark the ’ \d+ ‘ given commit’ ‘s’? $/,
93-
/^ <me($t)>‘, ¦HEAD: «’ (\d+)\.\d+ <?{ $0 >= 2 }> ‘»’ $/,
93+
/^ <me($t)>‘, ¦HEAD: «’ (\d+)\.\d+ <?{ $0 2 }> ‘»’ $/,
9494
:30timeout);
9595

9696
$t.test(“compare” query,
97-
bench: compare HEAD say "hi" ||| say "bye",
97+
bench: compare HEAD say ‘hi’ ||| say bye,
9898
/^ <me($t)>‘, starting to benchmark the ’ \d+ ‘ given commit’ ‘s’? $/,
9999
{$t.our-nick}, https://whatever.able/fakeupload);
100100

t/bisectable.t

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ $t.test(‘bisect by output’,
8888
{$t.our-nick}, (2016-02-04) https://github.com/rakudo/rakudo/commit/241e6c06a9ec4c918effffc30258f2658aad7b79);
8989

9090
$t.test(bisect by exit signal,
91-
bisect: old=2015.10 new=2015.12 Buf.new(0xFE).decode("utf8-c8") # RT 126756,
91+
bisect: old=2015.10 new=2015.12 Buf.new(0xFE).decode(utf8-c8) # RT 126756,
9292
{$t.our-nick}, Bisecting by exit signal (old=2015.10 new=2015.12). Old exit signal: 0 (None),
9393
{$t.our-nick}, bisect log: https://whatever.able/fakeupload,
9494
{$t.our-nick}, (2015-11-09) https://github.com/rakudo/rakudo/commit/3fddcb57f66a44d1a8adb7ecee1a3b403ab9f5d8);
9595

9696
$t.test(inverted exit signal,
97-
bisect: Buf.new(0xFE).decode("utf8-c8") # RT 126756,
97+
bisect: Buf.new(0xFE).decode(utf8-c8) # RT 126756,
9898
/^ <me($t)>‘, Bisecting by exit signal (old=2015.12 new=’<sha>‘). Old exit signal: 11 (SIGSEGV)’ $/,
9999
{$t.our-nick}, bisect log: https://whatever.able/fakeupload,
100100
{$t.our-nick}, (2016-04-01) https://github.com/rakudo/rakudo/commit/a87fb43b6c85a496ef0358197625b5b417a0d372);
@@ -105,7 +105,7 @@ $t.test(‘nothing to bisect’,
105105
{$t.our-nick}, Output on both points: «hello world»);
106106

107107
$t.test(nothing to bisect, segmentation fault everywhere,
108-
bisect: old=2016.02 new=2016.03 Buf.new(0xFE).decode("utf8-c8"),
108+
bisect: old=2016.02 new=2016.03 Buf.new(0xFE).decode(utf8-c8),
109109
{$t.our-nick}, On both starting points (old=2016.02 new=2016.03) the exit code is 0, exit signal is 11 (SIGSEGV) and the output is identical as well,
110110
{$t.our-nick}, Output on both points: «»);
111111

t/lib/Testable.pm6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Testable {
5959
}
6060
@got.push: $message
6161
}
62-
if @expected != @got or any(@got Z!~~ @expected) {
62+
if @expected @got or any(@got Z!~~ @expected) {
6363
diag expected: {@expected.perl}; # RT #129192
6464
diag got: {@got.perl};
6565
my $frame = callframe(2);

0 commit comments

Comments
 (0)