5 use lib "$FindBin::Bin/../lib";
6 use File::Temp qw/ tempdir /;
10 my $home = tempdir( CLEANUP => 1 );
11 my $path = File::Spec->catfile($home, 'testapp.psgi');
12 open(my $psgi, '>', $path)
22 # Check we wrote out something that compiles
23 system($^X, '-I', "$FindBin::Bin/../lib", '-c', $path)
24 ? fail('.psgi does not compile')
25 : pass('.psgi compiles');
27 # NOTE - YOU *CANNOT* do something like:
28 #my $psgi_ref = require $path;
29 # otherwise this test passes!
30 # I don't exactly know why that is yet, however, to be safe for future, that
31 # is why this test writes out it's own .psgi file in a temp directory - so that that
32 # path has never been require'd before, and will never be require'd again..
34 local TestApp->config->{home} = $home;
38 # Catch infinite recursion (or anything else)
39 local $SIG{__WARN__} = sub { warn(@_); $failed = 1; die; };
40 TestApp->_finalized_psgi_app;
42 ok(!$@, 'No exception')
44 ok(!$failed, 'TestApp->_finalized_psgi_app works');