source: A2P/a2p/test/e-adresse.pl

Last change on this file was 3, checked in by guillaume, 17 years ago
  • AUTHORS: Ajout des différents contributeurs
  • COPYING: Ajout de la licence GPL v3
  • a2p: Préparation des sources pour leur publication sous GPL
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1#! /usr/bin/perl
2#
3# Copyright (c) 2004-2007 - Consultas, PKG.fr
4#
5# This file is part of A2P.
6#
7# A2P is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# A2P is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with A2P; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20#
21# $Id: e-adresse.pl 3 2007-10-18 16:20:19Z guillaume $
22#
23
24use strict ;
25use Test ;
26
27require 'test/A2P/Defaults.pm' ;
28
29use warnings FATAL => qw(void);
30
31BEGIN {
32    plan
33        tests  => 7,
34        onfail => sub { exit(1) }
35}
36
37$| = 1 ;
38
39$ENV{JOB} = "TEST-JOB-EADRESSE" ;
40
41my $script = "LANG=C EADRESSE_CONF=test perl e-adresse.pl" ;
42# We should start the script in each possible mode with a test file
43
44# A simple call must fail as script is expecting something to do
45ok system( $script);
46# A call with a bad file must fail, also if more than 2 args are given
47ok system( $script . ' test/e-adresse-good.xml' );
48ok system( $script . ' test/e-adresse-good.xml test/e-adresse-a2p.xml' );
49
50# A call with a right formatted file must return 0
51my $mail = '/tmp/e-adresse.txt' ;
52unlink $mail if -s $mail ;
53ok ! system( $script . ' test/e-adresse-a2p.xml' );
54ok -s $mail ;
55unlink $mail if -s $mail ;
56ok ! system( 'cat test/e-adresse-a2p.xml | ' . $script );
57ok -s $mail ;
Note: See TracBrowser for help on using the repository browser.