aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-03-22 04:51:52 +0100
committerTristan Gingold <tgingold@free.fr>2023-03-22 07:02:34 +0100
commit863df0ba75e7bd883b53a47e600955c249015462 (patch)
treef4c58eabacd797e9469b9648f93c4fb62516150d /testsuite
parent89a4f10e21459614c0b52829d8bc3156c7280f8c (diff)
downloadghdl-863df0ba75e7bd883b53a47e600955c249015462.tar.gz
ghdl-863df0ba75e7bd883b53a47e600955c249015462.tar.bz2
ghdl-863df0ba75e7bd883b53a47e600955c249015462.zip
testsuite/gna: add a test for duplicate hide warning.
Part of #2396
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/gna/issue2396/repro_warn1.vhdl17
-rwxr-xr-xtestsuite/gna/issue2396/testsuite.sh9
2 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/gna/issue2396/repro_warn1.vhdl b/testsuite/gna/issue2396/repro_warn1.vhdl
new file mode 100644
index 000000000..8ac18b727
--- /dev/null
+++ b/testsuite/gna/issue2396/repro_warn1.vhdl
@@ -0,0 +1,17 @@
+package repro_warn1 is
+
+ type repro_warn1 is range 0 to 2e9 units
+ Hz ;
+ kHz = 1000 Hz ;
+ end units ;
+
+ function half_period(freq : time) return time ;
+end;
+
+package body repro_warn1 is
+
+ function half_period(freq : time) return time is
+ begin
+ return freq / 2.0 ;
+ end function ;
+end package body ;
diff --git a/testsuite/gna/issue2396/testsuite.sh b/testsuite/gna/issue2396/testsuite.sh
index 7732bdc6f..347926013 100755
--- a/testsuite/gna/issue2396/testsuite.sh
+++ b/testsuite/gna/issue2396/testsuite.sh
@@ -3,6 +3,15 @@
. ../../testenv.sh
export GHDL_STD_FLAGS=--std=08
+
+# Analyze and check hide warning number.
+analyze -Whide repro_warn1.vhdl 2>&1 | grep -c warning > warning.cnt
+if [ $(cat warning.cnt) -ne 1 ]; then
+ echo "incorrect warning number"
+ exit 1
+fi
+rm warning.cnt
+
analyze frequency.vhdl
analyze tb_freq.vhdl
elab_simulate tb_freq --stop-time=1us