summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-15 05:23:15 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-15 05:23:15 +0000
commit8a6f6c4c06055ecdeba5d823d3727cd382a26020 (patch)
tree860ed16056384da6408cc2a78358b8c766280ba2 /eclass
parentrelocate tests to tests/ subdir (diff)
downloadgentoo-2-8a6f6c4c06055ecdeba5d823d3727cd382a26020.tar.gz
gentoo-2-8a6f6c4c06055ecdeba5d823d3727cd382a26020.tar.bz2
gentoo-2-8a6f6c4c06055ecdeba5d823d3727cd382a26020.zip
relocate tests to tests/ subdir
Diffstat (limited to 'eclass')
-rw-r--r--eclass/flag-o-matic.eclass28
-rwxr-xr-xeclass/tests/flag-o-matic.sh50
2 files changed, 51 insertions, 27 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 5fbb60770bdf..0c7c4700d490 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.160 2011/12/10 20:03:17 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.161 2011/12/15 05:23:15 vapier Exp $
# @ECLASS: flag-o-matic.eclass
# @MAINTAINER:
@@ -687,30 +687,4 @@ no-as-needed() {
esac
}
-# Some tests for when we screw with things and want to make
-# sure we didn't break anything
-#TESTS() {
-# CFLAGS="-a -b -c=1"
-# CXXFLAGS="-x -y -z=2"
-# LDFLAGS="-l -m -n=3"
-#
-# die() { exit 1; }
-# (is-flag 1 2 3) && die
-# (is-ldflag 1 2 3) && die
-#
-# is-flagq -l && die
-# is-ldflagq -a && die
-# is-flagq -a || die
-# is-flagq -x || die
-# is-ldflagq -n=* || die
-# is-ldflagq -n && die
-#
-# strip-unsupported-flags
-# [[ ${CFLAGS} == "-c=1" ]] || die
-# [[ ${CXXFLAGS} == "-y -z=2" ]] || die
-#
-# echo "All tests pass"
-#}
-#TESTS
-
fi
diff --git a/eclass/tests/flag-o-matic.sh b/eclass/tests/flag-o-matic.sh
new file mode 100755
index 000000000000..357741771bf5
--- /dev/null
+++ b/eclass/tests/flag-o-matic.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+source tests-common.sh
+
+inherit flag-o-matic
+
+CFLAGS="-a -b -c=1"
+CXXFLAGS="-x -y -z=2"
+LDFLAGS="-l -m -n=3"
+
+tbegin "is-flag"
+! (is-flag 1 2 3) 2>/dev/null
+tend $?
+
+tbegin "is-ldflag"
+! (is-ldflag 1 2 3) 2>/dev/null
+tend $?
+
+while read exp flag ; do
+ [[ -z ${exp}${flag} ]] && continue
+
+ tbegin "is-flagq ${flag}"
+ is-flagq ${flag}
+ [[ ${exp} -eq $? ]]
+ tend $? "CFLAGS=${CFLAGS}"
+done <<<"
+ 1 -l
+ 0 -a
+ 0 -x
+"
+
+while read exp flag ; do
+ [[ -z ${exp}${flag} ]] && continue
+
+ tbegin "is-ldflagq ${flag}"
+ is-ldflagq "${flag}"
+ [[ ${exp} -eq $? ]]
+ tend $? "LDFLAGS=${LDFLAGS}"
+done <<<"
+ 1 -a
+ 0 -n=*
+ 1 -n
+"
+
+tbegin "strip-unsupported-flags"
+strip-unsupported-flags
+[[ ${CFLAGS} == "" ]] && [[ ${CXXFLAGS} == "-z=2" ]]
+tend $? "CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}"
+
+texit