test/nocomments.sh

Thu, 23 Aug 2018 19:45:36 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 23 Aug 2018 19:45:36 +0200
changeset 57
68018eac46c3
parent 56
ed65f8c73fb2
child 68
ae763178ee1e
permissions
-rwxr-xr-x

adds simple tiny test suite and updates license headers

universe@56 1 #!/bin/sh
universe@56 2 #
universe@56 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@56 4 #
universe@56 5 # Copyright 2018 Mike Becker. All rights reserved.
universe@56 6 #
universe@56 7 # Redistribution and use in source and binary forms, with or without
universe@56 8 # modification, are permitted provided that the following conditions are met:
universe@56 9 #
universe@56 10 # 1. Redistributions of source code must retain the above copyright
universe@56 11 # notice, this list of conditions and the following disclaimer.
universe@56 12 #
universe@56 13 # 2. Redistributions in binary form must reproduce the above copyright
universe@56 14 # notice, this list of conditions and the following disclaimer in the
universe@56 15 # documentation and/or other materials provided with the distribution.
universe@56 16 #
universe@56 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@56 18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@56 19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
universe@56 20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
universe@56 21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
universe@56 22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
universe@56 23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
universe@56 24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
universe@56 25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
universe@56 26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
universe@56 27 # POSSIBILITY OF SUCH DAMAGE.
universe@56 28 #
universe@56 29
universe@57 30 echo -n "Verifying correctness of line count without comments: "
universe@56 31
universe@57 32 clineprg="$(pwd)/../src/cline"
universe@57 33
universe@57 34 cd $srcdir
universe@57 35 count=`$clineprg -Vs testfile.c --exclude-cstyle-comments`
universe@57 36 expected=12
universe@57 37
universe@57 38 if [ "$count" -eq "$expected" ]; then
universe@57 39 echo "OK."
universe@57 40 exit 0;
universe@57 41 else
universe@57 42 echo "FAIL! $count is not $expected"
universe@57 43 exit 1;
universe@57 44 fi

mercurial