manifest_include 't/lib/TestMiddlewareFromConfig/share' => qr/.*/;
manifest_include 't/lib/TestMiddlewareFromConfig' => 'testmiddlewarefromconfig.pl';
manifest_include t => qr/optional_apache-.*\.pl/;
-manifest_include t => 'optional_stress.yml';
+manifest_include t => 'optional_stress.json';
manifest_include t => 'something/Makefile.PL';
manifest_include t => 'something/script/foo/bar/for_dist';
manifest_include t => 'utf8.txt';
use warnings;
use base 'Catalyst::Controller';
-eval 'use YAML';
+use JSON::MaybeXS qw(encode_json);
sub system : Local {
my ($self, $c, $ls) = @_;
$result = $! if $result != 0;
}
- $c->response->body(Dump({result => $result}));
+ $c->response->body(encode_json({result => $result}));
}
sub backticks : Local {
$code = $?;
}
- $c->response->body(Dump({result => $result, code => $code}));
+ $c->response->body(encode_json({result => $result, code => $code}));
}
sub fork : Local {
waitpid $pid,0 or die;
- $c->response->body(Dump({pid => $pid, result => $x}));
+ $c->response->body(encode_json({pid => $pid, result => $x}));
}
1;
use FindBin;
use lib "$FindBin::Bin/lib";
use Catalyst::Test qw(TestApp);
-
-eval 'use YAML';
-plan skip_all => 'YAML required' if $@;
+use JSON::MaybeXS qw(decode_json);
plan skip_all => 'Using remote server (and REMOTE_FORK not set)'
if $ENV{CATALYST_SERVER} && !$ENV{REMOTE_FORK};
ok(my $result = get('/fork/system/%2Fbin%2Fls'), 'system');
if (my $result_ref = result_ok($result)) {
- ok($result_ref, 'is YAML');
+ ok($result_ref, 'is JSON');
is($result_ref->{result}, 0, 'exited OK');
}
}
ok(my $result = get('/fork/backticks/%2Fbin%2Fls'), '`backticks`');
if (my $result_ref = result_ok($result)) {
- ok($result_ref, 'is YAML');
+ ok($result_ref, 'is JSON');
is($result_ref->{code}, 0, 'exited successfully');
like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$');
like($result_ref->{result}, qr{\n.*\n}m, 'contains two newlines');
ok(my $result = get('/fork/fork'), 'fork');
if (my $result_ref = result_ok($result)) {
- ok($result_ref, 'is YAML');
+ ok($result_ref, 'is JSON');
isnt($result_ref->{pid}, 0, q{fork's "pid" wasn't 0});
isnt($result_ref->{pid}, $$, 'fork got a new pid');
is($result_ref->{result}, 'ok', 'fork was effective');
$result =~ s/\r\n|\r/\n/g;
- return eval { Load($result) };
+ return eval { decode_json($result) };
}
done_testing;
eval "use HTTP::Body 0.03";
plan skip_all => 'HTTP::Body >= 0.03 required for this test' if $@;
-eval "use YAML";
-plan skip_all => 'YAML required for this test' if $@;
+use JSON::MaybeXS qw(decode_json);
our $t = Proc::ProcessTable->new( cache_ttys => 1 );
our ( $initial, $final ) = ( 0, 0 );
-our $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml");
+my $test_data = do {
+ open my $fh, '<:raw', "$FindBin::Bin/optional_stress.json" or die "$!";
+ local $/;
+ <$fh>;
+};
+
+our $tests = decode_json($test_data);
my $total_tests = 0;
--- /dev/null
+{
+ "component/controller/action/auto" : [
+ "http://localhost/action/auto/one",
+ "http://localhost/action/auto/anything",
+ "http://localhost/action/auto/deep/one",
+ "http://localhost/action/auto/deep/anything",
+ "http://localhost/action/auto/abort/one",
+ "http://localhost/action/auto/abort/anything"
+ ],
+ "component/controller/action/begin" : [
+ "http://localhost/action/begin"
+ ],
+ "component/controller/action/default" : [
+ "http://localhost/action/default",
+ "http://localhost/foo/bar/action",
+ "http://localhost/action/default/arg1/arg2"
+ ],
+ "component/controller/action/detach" : [
+ "http://localhost/action/detach/one",
+ "http://localhost/action/detach/path",
+ "http://localhost/action/detach/with_args/old",
+ "http://localhost/action/detach/with_method_and_args/old"
+ ],
+ "component/controller/action/end" : [
+ "http://localhost/action/end"
+ ],
+ "component/controller/action/forward" : [
+ "http://localhost/action/forward/global",
+ "http://localhost/action/forward/one",
+ "http://localhost/action/forward/jojo",
+ "http://localhost/action/forward/with_args/old",
+ "http://localhost/action/forward/with_method_and_args/old",
+ "http://localhost/action/forward/args_embed_relative",
+ "http://localhost/action/forward/args_embed_absolute"
+ ],
+ "component/controller/action/global" : [
+ "http://localhost/action_global_one",
+ "http://localhost/action_global_two",
+ "http://localhost/action_global_three"
+ ],
+ "component/controller/action/index" : [
+ "http://localhost/",
+ "http://localhost",
+ "http://localhost/index/",
+ "http://localhost/index",
+ "http://localhost/action/index/",
+ "http://localhost/action/index",
+ "http://localhost/action/index/foo"
+ ],
+ "component/controller/action/inheritance" : [
+ "http://localhost/action/inheritance",
+ "http://localhost/action/inheritance/a",
+ "http://localhost/action/inheritance/a/b"
+ ],
+ "component/controller/action/local" : [
+ "http://localhost/action/local/one",
+ "http://localhost/action/local/two",
+ "http://localhost/action/local/three",
+ "http://localhost/action/local/four/five/six"
+ ],
+ "component/controller/action/multipath" : [
+ "http://localhost/action/multipath/multipath",
+ "http://localhost/multipath",
+ "http://localhost/multipath1",
+ "http://localhost/action/multipath/multipath2"
+ ],
+ "component/controller/action/path" : [
+ "http://localhost/action/path/a path with spaces",
+ "http://localhost/action/path/åäö"
+ ],
+ "component/controller/action/private" : [
+ "http://localhost/action/private/one",
+ "http://localhost/action/private/two",
+ "http://localhost/three",
+ "http://localhost/action/private/four",
+ "http://localhost/action/private/five"
+ ],
+ "component/controller/action/regexp" : [
+ "http://localhost/action/regexp/10/hello",
+ "http://localhost/action/regexp/hello/10"
+ ],
+ "component/controller/action/streaming" : [
+ "http://localhost/streaming",
+ "http://localhost/action/streaming/body"
+ ],
+ "engine/request/body" : [],
+ "engine/request/cookies" : [],
+ "engine/request/headers" : [],
+ "engine/request/parameters" : [],
+ "engine/request/uploads" : [],
+ "engine/request/uri" : [
+ "http://localhost/engine/request/uri/change_path",
+ "http://localhost/engine/request/uri/change_base",
+ "http://localhost/engine/request/uri",
+ "http://localhost/engine/request/uri?a=1;a=2;b=3",
+ "http://localhost/engine/request/uri?text=Catalyst%20Rocks"
+ ],
+ "engine/response/cookies" : [
+ "http://localhost/engine/response/cookies/one",
+ "http://localhost/engine/response/cookies/two"
+ ],
+ "engine/response/errors" : [
+ "http://localhost/engine/response/errors/one",
+ "http://localhost/engine/response/errors/two",
+ "http://localhost/engine/response/errors/three"
+ ],
+ "engine/response/headers" : [
+ "http://localhost/engine/response/headers/one"
+ ],
+ "engine/response/large" : [
+ "http://localhost/engine/response/large/"
+ ],
+ "engine/response/redirect" : [
+ "http://localhost/engine/response/redirect/one",
+ "http://localhost/engine/response/redirect/two",
+ "http://localhost/engine/response/redirect/three",
+ "http://localhost/engine/response/redirect/four"
+ ],
+ "engine/response/status" : [
+ "http://localhost/engine/response/status/s200",
+ "http://localhost/engine/response/status/s400",
+ "http://localhost/engine/response/status/s403",
+ "http://localhost/engine/response/status/s404",
+ "http://localhost/engine/response/status/s500"
+ ]
+}
our ( $iters, $tests );
BEGIN {
- eval "use YAML";
- plan skip_all => 'YAML is required for this test' if $@;
+ use JSON::MaybeXS qw(decode_json);
+
+ my $test_data = do {
+ open my $fh, '<:raw', "$FindBin::Bin/optional_stress.json" or die "$!";
+ local $/;
+ <$fh>;
+ };
$iters = $ENV{TEST_STRESS} || 10;
- $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml");
+ $tests = decode_json($test_data);
my $total_tests = 0;
map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests};
+++ /dev/null
----
-component/controller/action/auto:
- - http://localhost/action/auto/one
- - http://localhost/action/auto/anything
- - http://localhost/action/auto/deep/one
- - http://localhost/action/auto/deep/anything
- - http://localhost/action/auto/abort/one
- - http://localhost/action/auto/abort/anything
-component/controller/action/begin:
- - http://localhost/action/begin
-component/controller/action/default:
- - http://localhost/action/default
- - http://localhost/foo/bar/action
- - http://localhost/action/default/arg1/arg2
-component/controller/action/detach:
- - http://localhost/action/detach/one
- - http://localhost/action/detach/path
- - http://localhost/action/detach/with_args/old
- - http://localhost/action/detach/with_method_and_args/old
-component/controller/action/end:
- - http://localhost/action/end
-component/controller/action/forward:
- - http://localhost/action/forward/global
- - http://localhost/action/forward/one
- - http://localhost/action/forward/jojo
- - http://localhost/action/forward/with_args/old
- - http://localhost/action/forward/with_method_and_args/old
- - http://localhost/action/forward/args_embed_relative
- - http://localhost/action/forward/args_embed_absolute
-component/controller/action/global:
- - http://localhost/action_global_one
- - http://localhost/action_global_two
- - http://localhost/action_global_three
-component/controller/action/index:
- - http://localhost/
- - http://localhost
- - http://localhost/index/
- - http://localhost/index
- - http://localhost/action/index/
- - http://localhost/action/index
- - http://localhost/action/index/foo
-component/controller/action/inheritance:
- - http://localhost/action/inheritance
- - http://localhost/action/inheritance/a
- - http://localhost/action/inheritance/a/b
-component/controller/action/local:
- - http://localhost/action/local/one
- - http://localhost/action/local/two
- - http://localhost/action/local/three
- - http://localhost/action/local/four/five/six
-component/controller/action/multipath:
- - http://localhost/action/multipath/multipath
- - http://localhost/multipath
- - http://localhost/multipath1
- - http://localhost/action/multipath/multipath2
-component/controller/action/path:
- - http://localhost/action/path/a path with spaces
- - http://localhost/action/path/åäö
-component/controller/action/private:
- - http://localhost/action/private/one
- - http://localhost/action/private/two
- - http://localhost/three
- - http://localhost/action/private/four
- - http://localhost/action/private/five
-component/controller/action/regexp:
- - http://localhost/action/regexp/10/hello
- - http://localhost/action/regexp/hello/10
-component/controller/action/streaming:
- - http://localhost/streaming
- - http://localhost/action/streaming/body
-engine/request/body: []
-engine/request/cookies: []
-engine/request/headers: []
-engine/request/parameters: []
-engine/request/uploads: []
-engine/request/uri:
- - http://localhost/engine/request/uri/change_path
- - http://localhost/engine/request/uri/change_base
- - http://localhost/engine/request/uri
- - http://localhost/engine/request/uri?a=1;a=2;b=3
- - http://localhost/engine/request/uri?text=Catalyst%20Rocks
-engine/response/cookies:
- - http://localhost/engine/response/cookies/one
- - http://localhost/engine/response/cookies/two
-engine/response/errors:
- - http://localhost/engine/response/errors/one
- - http://localhost/engine/response/errors/two
- - http://localhost/engine/response/errors/three
-engine/response/headers:
- - http://localhost/engine/response/headers/one
-engine/response/large:
- - http://localhost/engine/response/large/
-engine/response/redirect:
- - http://localhost/engine/response/redirect/one
- - http://localhost/engine/response/redirect/two
- - http://localhost/engine/response/redirect/three
- - http://localhost/engine/response/redirect/four
-engine/response/status:
- - http://localhost/engine/response/status/s200
- - http://localhost/engine/response/status/s400
- - http://localhost/engine/response/status/s403
- - http://localhost/engine/response/status/s404
- - http://localhost/engine/response/status/s500