/[webpac2]/trunk/t/5-output-json.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/5-output-json.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 881 - (show annotations)
Thu Aug 23 20:28:09 2007 UTC (16 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 831 byte(s)
 r1311@llin:  dpavlin | 2007-08-23 22:16:00 +0200
 skeleton for WebPAC::Output::JSON

1 #!/usr/bin/perl -w
2
3 use Test::More tests => 7;
4 use Test::Exception;
5 use Cwd qw/abs_path/;
6 use blib;
7 use strict;
8
9 BEGIN {
10 use_ok( 'WebPAC::Output::JSON' );
11 }
12
13 ok(my $abs_path = abs_path($0), "abs_path");
14 $abs_path =~ s#/[^/]*$#/#; #
15 diag "abs_path: $abs_path";
16
17 ok(my $out = new WebPAC::Output::JSON({
18 path => "$abs_path/out/test.js",
19 }), "new");
20
21 ok( $out->init, 'init' );
22
23 my $ds = {
24 'Source' => {
25 'name' => 'Izvor: ',
26 'tag' => 'Source',
27 'display' => [ 'foo' ]
28 },
29 'ID' => {
30 'name' => 'ID',
31 'tag' => 'IDths',
32 'search' => [ 'bar' ],
33 'lookup_key' => [ 'bar' ]
34 },
35 'filename' => [ 'out/thes/001.html' ],
36 'name' => 'filename',
37 'tag' => 'filename'
38 };
39
40 throws_ok { $out->add( ) } qr/need id/, 'add without params';
41 throws_ok { $out->add( 42 ) } qr/need ds/, 'add without ds';
42
43 ok( $out->add( 42, $ds ), 'add' );
44
45

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26