Add a few new negative dfilter tests.

For example, to ensure that "field = value" is not a valid dfilter (as was
recently a problem).

As suggested by Alexis.

Change-Id: Ibf498c30325579e3d5474bb2d397f1bbb9ffc07f
Reviewed-on: https://code.wireshark.org/review/11339
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jeff Morriss 2015-10-27 18:44:35 -04:00 committed by Anders Broman
parent 2014eb0ad3
commit 7a78d4113e
1 changed files with 17 additions and 2 deletions

View File

@ -4,12 +4,12 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@ -28,6 +28,21 @@ class testInteger(dftest.DFTest):
dfilter = "ip.version == 6"
self.assertDFilterCount(dfilter, 0)
def test_eq_3(self):
# Invalid filter (only one equals sign)
dfilter = "ip.version = 4"
self.assertDFilterFail(dfilter)
def test_eq_4(self):
# Invalid filter
dfilter = "ip.version == the quick brown fox jumps over the lazy dog"
self.assertDFilterFail(dfilter)
def test_eq_5(self):
# Invalid filter
dfilter = "ip.version == 4 the quick brown fox jumps over the lazy dog"
self.assertDFilterFail(dfilter)
def test_ne_1(self):
dfilter = "ip.version != 0"
self.assertDFilterCount(dfilter, 1)