1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
BEGIN {
plan(skip_all => 'network tests disabled for shipped version')
unless $ENV{RELEASE_TESTING};
}
use Cwd;
use File::Temp;
use Path::Class;
use Resource::Pack::jQuery;
{
my $oldcwd = getcwd;
my $dir = File::Temp->newdir;
chdir $dir;
my $file = file('jquery-1.4.2.min.js');
my $resource = Resource::Pack::jQuery->new(
version => '1.4.2',
);
ok(!-e $file, "jquery doesn't exist yet");
$resource->install;
ok(-e $file, "jquery exists!");
like($file->slurp, qr/jQuery JavaScript Library v1\.4\.2/,
"got the right jquery version");
like($file->slurp, qr/\Q(function(A,w){function ma(){/,
"got the minified jquery");
chdir $oldcwd;
}
{
my $oldcwd = getcwd;
my $dir = File::Temp->newdir;
chdir $dir;
my $file = file('jquery-1.4.2.js');
my $resource = Resource::Pack::jQuery->new(
version => '1.4.2',
minified => 0,
);
ok(!-e $file, "jquery doesn't exist yet");
$resource->install;
ok(-e $file, "jquery exists!");
like($file->slurp, qr/jQuery JavaScript Library v1\.4\.2/,
"got the right jquery version");
like($file->slurp, qr:\Qvar jQuery = function(:,
"got the non-minified jquery");
chdir $oldcwd;
}
{
my $oldcwd = getcwd;
my $dir = File::Temp->newdir;
chdir $dir;
my $file = file('jquery-1.3.2.min.js');
my $resource = Resource::Pack::jQuery->new(
version => '1.3.2',
);
ok(!-e $file, "jquery doesn't exist yet");
$resource->install;
ok(-e $file, "jquery exists!");
like($file->slurp, qr/jQuery JavaScript Library v1\.3\.2/,
"got the right jquery version");
like($file->slurp, qr/\Q(function(){var l/,
"got the minified jquery");
chdir $oldcwd;
}
{
my $oldcwd = getcwd;
my $dir = File::Temp->newdir;
chdir $dir;
my $file = file('jquery-1.3.2.js');
my $resource = Resource::Pack::jQuery->new(
version => '1.3.2',
minified => 0,
);
ok(!-e $file, "jquery doesn't exist yet");
$resource->install;
ok(-e $file, "jquery exists!");
like($file->slurp, qr/jQuery JavaScript Library v1\.3\.2/,
"got the right jquery version");
like($file->slurp, qr:\QjQuery.fn = jQuery.prototype = {:,
"got the non-minified jquery");
chdir $oldcwd;
}
done_testing;
|