~ubuntu-branches/ubuntu/breezy/unifdef/breezy

« back to all changes in this revision

Viewing changes to tests/simple3

  • Committer: Bazaar Package Importer
  • Author(s): Bob Proulx
  • Date: 2004-07-03 18:09:39 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040703180939-iv7azs869mqz47p8
Tags: 1.0+20030701-1
* Switch to current FreeBSD version version of unifdef.  This is
  effectively a switch to a new upstream version.  Really it is
  switching to a different branching of the original code base.
* Suggestion to switch to the newer FreeBSD version. (Closes: #234054)
* Whitespace is now allowed at the beginning of #if line before the '#'
  character.  (Closes: #204349)
* Whitespace is now generally ignored around the preprocessor
  directives.  This allows indention of preprocessor control flow.
* Previously only "#ifdef" and "#ifndef" preprocessor controls were
  handled giving the program the justifiable name of "unifdef".  Now
  general "#if" processing such as "#if defined(FOO)" and boolean
  expresions of those constructs are allowed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
srcdir=${srcdir:-"."}
 
4
errors=false
 
5
 
 
6
for t in if1 if2 if3 if4 if5; do
 
7
 
 
8
  failed=false
 
9
 
 
10
  if [ ! -f ${srcdir}/${t}.c.expout ]; then
 
11
    echo FAILED: EXPOUT: ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c
 
12
    echo Test Framework Error: Missing ${srcdir}/${t}.c.expout 1>&2
 
13
    exit 1
 
14
  fi
 
15
  if [ ! -f ${srcdir}/${t}.c.experr ]; then
 
16
    echo FAILED: EXPERR: ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c
 
17
    echo Test Framework Error: Missing ${srcdir}/${t}.c.experr 1>&2
 
18
    exit 1
 
19
  fi
 
20
 
 
21
  ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c >${t}.out 2>${t}.err
 
22
 
 
23
  if [ $? -eq 0 ]; then
 
24
    echo FAILED: RC: ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c
 
25
    echo Error: exit code zero when changes exist. 1>&2
 
26
    error=true
 
27
    failed=true
 
28
  fi
 
29
 
 
30
  if ! cmp -s ${t}.out ${srcdir}/${t}.c.expout; then
 
31
    echo FAILED: OUT: ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c
 
32
    echo Standard output differences $t
 
33
    diff ${t}.out ${srcdir}/${t}.c.expout
 
34
    errors=true
 
35
    failed=true
 
36
  fi
 
37
  if ! cmp -s ${t}.err ${srcdir}/${t}.c.experr; then
 
38
    echo FAILED: ERR: ../src/unifdef -DFOO=1 -DFOOB=42 -UBAR ${srcdir}/${t}.c
 
39
    echo Standard error differences $t
 
40
    diff ${t}.out ${srcdir}/${t}.c.expout
 
41
    errors=true
 
42
    failed=true
 
43
  fi
 
44
 
 
45
  if ! $failed; then
 
46
    rm -f ${t}.out ${t}.err
 
47
  fi
 
48
 
 
49
done
 
50
 
 
51
if $errors; then
 
52
  exit 1
 
53
fi
 
54
 
 
55
exit 0