mem.t: Replace obsolete megavideo URLs
[libquvi-scripts.git] / tests / t / mem.t
blob40d62857c14a4393eb70940c5805f01013b4af4b
1 # libquvi-scripts
2 # Copyright (C) 2011  Toni Gundogdu <legatvs@gmail.com>
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 # 02110-1301, USA.
19 use warnings;
20 use strict;
22 use Test::More;
23 use Test::Quvi;
25 my $q = Test::Quvi->new;
27 plan skip_all => "TEST_SKIP rule"
28   if $q->test_skip("mem");
30 my $c = $q->get_config;
32 plan skip_all =>
33   'valgrind required for testing, specify with --valgrind-path'
34   unless $c->{valgrind_path};
36 plan tests => 9;
38 # invalid option, make an exception to redirect to /dev/null),
39 # gengetopt produced code checks and exits if this error occurs.
40 my ($r) = $q->run_with_valgrind('--invalid', '2>/dev/null');
41 is($r, 0x1, "exit status == 0x1");
43 # --version
44 ($r) = $q->run_with_valgrind('--version');
45 is($r, 0x0, "exit status == 0x0");    # 0x0 = QUVI_OK
47 # --help
48 ($r) = $q->run_with_valgrind('--help');
49 is($r, 0x0, "exit status == 0x0");    # 0x0 = QUVI_OK
51 # --support
52 ($r) = $q->run_with_valgrind('--support');
53 is($r, 0x0, "exit status == 0x0");    # 0x0 = QUVI_OK
55 # --support arg
56 ($r) =
57   $q->run_with_valgrind('http://vimeo.com/1485507', '--support -vq -e-r');
58 is($r, 0x0, "exit status == 0x0");
60 # fetch, parse, exit
61 ($r) = $q->run_with_valgrind('http://vimeo.com/1485507', '-vq -e-r');
62 is($r, 0x0, "exit status == 0x0");
64 # fetch, parse, exec and exit
65 ($r) = $q->run_with_valgrind('http://vimeo.com/1485507',
66                              '-vq -e-r --exec "echo %t ; echo %u"');
67 is($r, 0x0, "exit status == 0x0");
69 # (fetch, parse) x 2, exit
70 ($r) =
71   $q->run_with_valgrind(
72                         'http://vimeo.com/1485507',
73                         'http://vimeo.com/35798934',
74                         '-vq -e-r'
75                        );
76 is($r, 0x0, "exit status == 0x0");
78 # (fetch, parse) x 2, exit
79 # NOTE: first fails intentionally
80 ($r) =
81   $q->run_with_valgrind(
82                         'http://ww.vimeo.com/1485507',
83                         'http://vimeo.com/35798934',
84                         '-vq -e-r'
85                        );
86 is($r, 0x0, "exit status == 0x0");
88 # vim: set ts=2 sw=2 tw=72 expandtab: