aboutsummaryrefslogtreecommitdiff
path: root/tests/comp02.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2014-12-10 08:56:48 +0200
committerSergey Poznyakoff <gray@gnu.org>2014-12-10 08:56:48 +0200
commitbdd68868836f01ac766afa1a6c79a5f7d4287da6 (patch)
treed875e9fbf02575c9da52a2846ac00d09d5d3cefa /tests/comp02.at
parent85dfe24a45c65a9f414769fe059b1c5a06a3b176 (diff)
downloadeclat-bdd68868836f01ac766afa1a6c79a5f7d4287da6.tar.gz
eclat-bdd68868836f01ac766afa1a6c79a5f7d4287da6.tar.bz2
Fix coredump when comparing non-existing nodes.
* lib/forlan.c (coerce_value): Handle NULL nodes. (values_equal): Handle NULL strings. (dump_expr): Handle EQ and NE. * lib/forlanlex.l: Fix distinction before negative numeric and identifier. * etc/describe-security-groups.fln: ipProtocol == "-1" means "all". * tests/Makefile.am: Add new tests. * tests/testsuite.at: Likewise. * tests/comp00.at: New file. * tests/comp01.at: New file. * tests/comp02.at: New file. * tests/comp03.at: New file. * tests/comp04.at: New file. * tests/tforlan.c (main): Optionally read XML from standard input.
Diffstat (limited to 'tests/comp02.at')
-rw-r--r--tests/comp02.at50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/comp02.at b/tests/comp02.at
new file mode 100644
index 0000000..0302c70
--- /dev/null
+++ b/tests/comp02.at
@@ -0,0 +1,50 @@
+# This file is part of Eclat -*- Autotest -*-
+# Copyright (C) 2012-2014 Sergey Poznyakoff
+#
+# Eclat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Eclat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Eclat. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([Node equals constant])
+AT_KEYWORDS([forlan compare comp comp02])
+
+AT_DATA([input],[
+if (.root.x == -1) print("PASS\n"); else print("FAIL\n");
+])
+
+AT_CHECK([tforlan -s input - <<EOT
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <x>-1</x>
+</root>
+EOT
+
+tforlan -s input - <<EOT
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <x>1</x>
+</root>
+EOT
+
+tforlan -s input - <<EOT
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <empty/>
+</root>
+EOT],
+[0],
+[PASS
+FAIL
+FAIL
+])
+
+AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.