From 2868eb61eab77b9fa038a91a75c68f375d2516d0 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Tue, 17 May 2022 12:08:53 +0200 Subject: [PATCH] add test for Parameter[any] and Parameter[any-named] --- python/ql/test/library-tests/frameworks/data/test.expected | 6 ++++++ python/ql/test/library-tests/frameworks/data/test.py | 6 ++++++ python/ql/test/library-tests/frameworks/data/test.ql | 2 ++ 3 files changed, 14 insertions(+) diff --git a/python/ql/test/library-tests/frameworks/data/test.expected b/python/ql/test/library-tests/frameworks/data/test.expected index 0b962e9be63..16ec37811a0 100644 --- a/python/ql/test/library-tests/frameworks/data/test.expected +++ b/python/ql/test/library-tests/frameworks/data/test.expected @@ -85,6 +85,12 @@ isSource | test.py:86:49:86:59 | ControlFlowNode for getSource() | test-source | | test.py:87:56:87:66 | ControlFlowNode for getSource() | test-source | | test.py:101:29:101:31 | ControlFlowNode for arg | test-source | +| test.py:104:18:104:21 | ControlFlowNode for self | test-source | +| test.py:104:24:104:29 | ControlFlowNode for param1 | test-source | +| test.py:104:32:104:37 | ControlFlowNode for param2 | test-source | +| test.py:107:18:107:21 | ControlFlowNode for self | test-source | +| test.py:107:24:107:28 | ControlFlowNode for name1 | test-source | +| test.py:107:31:107:35 | ControlFlowNode for name2 | test-source | syntaxErrors | Member[foo | | Member[foo] .Member[bar] | diff --git a/python/ql/test/library-tests/frameworks/data/test.py b/python/ql/test/library-tests/frameworks/data/test.py index 7b060946e57..abb4af545fa 100644 --- a/python/ql/test/library-tests/frameworks/data/test.py +++ b/python/ql/test/library-tests/frameworks/data/test.py @@ -100,3 +100,9 @@ baz2(baz2) # match class OtherSubClass (ArgPos.MyClass): def otherSelfTest(self, arg, named=2, otherName=3): # test that Parameter[0] hits `arg`. pass + + def anyParam(self, param1, param2): # Parameter[any] matches all 3. + pass + + def anyNamed(self, name1, name2=2): # Parameter[any-named] matches all 3. + pass diff --git a/python/ql/test/library-tests/frameworks/data/test.ql b/python/ql/test/library-tests/frameworks/data/test.ql index e42fd024e98..86f960b1adf 100644 --- a/python/ql/test/library-tests/frameworks/data/test.ql +++ b/python/ql/test/library-tests/frameworks/data/test.ql @@ -77,6 +77,8 @@ class Sources extends ModelInput::SourceModelCsv { "testlib;;Member[ArgPos].Member[MyClass].Subclass.Member[foo].Parameter[named:];test-source", // "testlib;;Member[ArgPos].Member[MyClass].Subclass.Member[secondAndAfter].Parameter[1..];test-source", // "testlib;;Member[ArgPos].Member[MyClass].Subclass.Member[otherSelfTest].Parameter[0];test-source", // + "testlib;;Member[ArgPos].Member[MyClass].Subclass.Member[anyParam].Parameter[any];test-source", // + "testlib;;Member[ArgPos].Member[MyClass].Subclass.Member[anyNamed].Parameter[any-named];test-source", // ] } }