]> Sergey Matveev's repositories - public-inbox.git/commitdiff
avoid wrong/needless squote_maybe shortcuts
authorEric Wong <e@80x24.org>
Sun, 18 Apr 2021 08:31:39 +0000 (08:31 +0000)
committerEric Wong <e@80x24.org>
Sun, 18 Apr 2021 23:04:41 +0000 (19:04 -0400)
We'll keep it in PublicInbox::Config for now, since I'm not
sure if there's a better place to put it.

lib/PublicInbox/LeiSavedSearch.pm
t/reply.t

index f40fe76bd0afef3cfe5f478f0496a91cd950256c..3076d14c1b4ae3959ddc363e08b2e69325503ebf 100644 (file)
@@ -13,8 +13,6 @@ use PublicInbox::Spawn qw(run_die);
 use PublicInbox::ContentHash qw(git_sha);
 use Digest::SHA qw(sha256_hex);
 
-*squote_maybe = \&PublicInbox::Config::squote_maybe;
-
 # move this to PublicInbox::Config if other things use it:
 my %cquote = ("\n" => '\\n', "\t" => '\\t', "\b" => '\\b');
 sub cquote_val ($) { # cf. git-config(1)
@@ -61,7 +59,7 @@ sub new {
                $self->{-cfg} = {};
                my $f = $self->{'-f'} = "$dir/lei.saved-search";
                open my $fh, '>', $f or return $lei->fail("open $f: $!");
-               my $sq_dst = squote_maybe($dst);
+               my $sq_dst = PublicInbox::Config::squote_maybe($dst);
                my $q = $lei->{mset_opt}->{q_raw} // die 'BUG: {q_raw} missing';
                if (ref $q) {
                        $q = join("\n", map { "\tq = ".cquote_val($_) } @$q);
index 1e89973e0730c92d346b51f2c66cfda1c4245f32..41d72db22c6586eb771009c056b413123ddae77c 100644 (file)
--- a/t/reply.t
+++ b/t/reply.t
@@ -1,8 +1,9 @@
+#!perl -w
 # Copyright (C) 2017-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
-use warnings;
 use Test::More;
+use PublicInbox::Config;
 use PublicInbox::Eml;
 use_ok 'PublicInbox::Reply';
 
@@ -15,7 +16,7 @@ my @q = (
 while (@q) {
        my $input = shift @q;
        my $expect = shift @q;
-       my $res = PublicInbox::Reply::squote_maybe($input);
+       my $res = PublicInbox::Config::squote_maybe($input);
        is($res, $expect, "quote $input => $res");
 }