diff --git a/actions/ql/test/utils/ActionsInlineExpectationsTestQuery.ql b/actions/ql/test/utils/ActionsInlineExpectationsTestQuery.ql index a67c200cf117..cf23944f553d 100644 --- a/actions/ql/test/utils/ActionsInlineExpectationsTestQuery.ql +++ b/actions/ql/test/utils/ActionsInlineExpectationsTestQuery.ql @@ -10,12 +10,6 @@ import T::TestPostProcessing private module Impl implements T::InlineExpectationsTestSig { class Location = Locations::Location; - class ExpectationComment extends Yaml::YamlComment { - string getContents() { result = this.getText() } - } -} - -private module Input implements T::TestPostProcessing::InputSig { string getRelativeUrl(Locations::Location location) { exists(int startLine, int startColumn, int endLine, int endColumn | location.hasLocationInfo(_, startLine, startColumn, endLine, endColumn) @@ -25,6 +19,10 @@ private module Input implements T::TestPostProcessing::InputSig { ":" + endColumn ) } + + class ExpectationComment extends Yaml::YamlComment { + string getContents() { result = this.getText() } + } } -import T::TestPostProcessing::Make +import T::TestPostProcessing::Make diff --git a/cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 8e6977ba5321..e71d67bc528c 100644 --- a/cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/cpp/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import cpp private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/cpp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/cpp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index d2c8efbf3165..18493c8ad19c 100644 --- a/cpp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/cpp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -25,4 +25,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = C::Location; + + string getRelativeUrl(Location location) { + exists(C::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/cpp/ql/test/include/iterator.h b/cpp/ql/test/include/iterator.h index 5cd7f2312842..77758bfa8da6 100644 --- a/cpp/ql/test/include/iterator.h +++ b/cpp/ql/test/include/iterator.h @@ -65,7 +65,7 @@ namespace std { }; template - constexpr back_insert_iterator back_inserter(Container& x) { // $ ir-def=*x + constexpr back_insert_iterator back_inserter(Container& x) { return back_insert_iterator(x); } @@ -89,7 +89,7 @@ namespace std { constexpr front_insert_iterator operator++(int); }; template - constexpr front_insert_iterator front_inserter(Container& x) { // $ ir-def=*x + constexpr front_insert_iterator front_inserter(Container& x) { return front_insert_iterator(x); } } diff --git a/csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 35901ee64012..1c5be4160ae0 100644 --- a/csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/csharp/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import csharp private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/csharp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/csharp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index 6916c5f61067..f623d683dca6 100644 --- a/csharp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/csharp/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -49,4 +49,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = CS::Location; + + string getRelativeUrl(Location location) { + exists(CS::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/go/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/go/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 1cf2f5ea1d9b..0d7462c57056 100644 --- a/go/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/go/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import go private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/go/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/go/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index 3bdc948842c7..3084c4846795 100644 --- a/go/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/go/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -20,4 +20,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = G::Location; + + string getRelativeUrl(Location location) { + exists(G::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/java/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/java/ql/lib/utils/test/InlineExpectationsTestQuery.ql index b0360dfecd8d..72cbb9c4148a 100644 --- a/java/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/java/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import java private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/java/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/java/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index 446b6a544c34..9a51a70eda60 100644 --- a/java/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/java/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -35,4 +35,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = J::Location; + + string getRelativeUrl(Location location) { + exists(J::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/java/ql/test-kotlin1/TestUtilities/internal/InlineExpectationsTestImpl.qll b/java/ql/test-kotlin1/TestUtilities/internal/InlineExpectationsTestImpl.qll index cd62fdb757e0..646501a84c91 100644 --- a/java/ql/test-kotlin1/TestUtilities/internal/InlineExpectationsTestImpl.qll +++ b/java/ql/test-kotlin1/TestUtilities/internal/InlineExpectationsTestImpl.qll @@ -32,4 +32,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = J::Location; + + string getRelativeUrl(Location location) { + exists(J::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/java/ql/test-kotlin2/TestUtilities/internal/InlineExpectationsTestImpl.qll b/java/ql/test-kotlin2/TestUtilities/internal/InlineExpectationsTestImpl.qll index cd62fdb757e0..646501a84c91 100644 --- a/java/ql/test-kotlin2/TestUtilities/internal/InlineExpectationsTestImpl.qll +++ b/java/ql/test-kotlin2/TestUtilities/internal/InlineExpectationsTestImpl.qll @@ -32,4 +32,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = J::Location; + + string getRelativeUrl(Location location) { + exists(J::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/javascript/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/javascript/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 55892be75d79..068f69d0013c 100644 --- a/javascript/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/javascript/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import javascript private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/javascript/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/javascript/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index 42eb94230ae6..d73cdcd321b5 100644 --- a/javascript/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/javascript/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -8,6 +8,16 @@ module Impl implements InlineExpectationsTestSig { class Location = JS::Location; + string getRelativeUrl(Location location) { + exists(JS::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } + abstract private class ExpectationCommentImpl extends Locatable { abstract string getContents(); diff --git a/python/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/python/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 9ce5fdf326ca..fa37afa388c0 100644 --- a/python/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/python/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import python private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/python/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/python/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index ea8faaeeae31..bc8c66cba5f3 100644 --- a/python/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/python/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -9,4 +9,14 @@ module Impl implements InlineExpectationsTestSig { class ExpectationComment = PY::Comment; class Location = PY::Location; + + string getRelativeUrl(Location location) { + exists(PY::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/ql/ql/src/utils/test/InlineExpectationsTestQuery.ql b/ql/ql/src/utils/test/InlineExpectationsTestQuery.ql index 979839480e1d..b5c70edad177 100644 --- a/ql/ql/src/utils/test/InlineExpectationsTestQuery.ql +++ b/ql/ql/src/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import ql private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/ql/ql/src/utils/test/internal/InlineExpectationsTestImpl.qll b/ql/ql/src/utils/test/internal/InlineExpectationsTestImpl.qll index 647ddd5a87db..88a30d0d4c7a 100644 --- a/ql/ql/src/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/ql/ql/src/utils/test/internal/InlineExpectationsTestImpl.qll @@ -25,4 +25,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = QL::Location; + + string getRelativeUrl(Location location) { + exists(QL::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/ruby/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/ruby/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 1cbc37a7fe85..08768162c173 100644 --- a/ruby/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/ruby/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import ruby private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index bd84f530f9c3..d445c91d2e8f 100644 --- a/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -36,4 +36,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = R::Location; + + string getRelativeUrl(Location location) { + exists(R::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/rust/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/rust/ql/lib/utils/test/InlineExpectationsTestQuery.ql index e5821ba4f50c..d97f49cb382f 100644 --- a/rust/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/rust/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import rust private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/rust/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/rust/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index c189e1c7e80e..5dc1dbaeb03d 100644 --- a/rust/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/rust/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -11,4 +11,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = R::Location; + + string getRelativeUrl(Location location) { + exists(R::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/shared/util/codeql/util/test/InlineExpectationsTest.qll b/shared/util/codeql/util/test/InlineExpectationsTest.qll index 4e0b2f678449..21c8c3a39f64 100644 --- a/shared/util/codeql/util/test/InlineExpectationsTest.qll +++ b/shared/util/codeql/util/test/InlineExpectationsTest.qll @@ -108,6 +108,9 @@ signature module InlineExpectationsTestSig { ); } + /** Gets the relative URL of the given location, if any. */ + string getRelativeUrl(Location location); + /** A comment that may contain inline expectations. */ class ExpectationComment { /** Gets the contents of this comment, _excluding_ the comment indicator. */ @@ -242,9 +245,13 @@ module Make { TActualResult( Impl::Location location, string element, string tag, string value, boolean optional ) { - TestImpl::hasActualResult(location, element, tag, value) and optional = false - or - TestImpl::hasOptionalResult(location, element, tag, value) and optional = true + ( + TestImpl::hasActualResult(location, element, tag, value) and optional = false + or + TestImpl::hasOptionalResult(location, element, tag, value) and optional = true + ) and + // test expectations can only be defined in source code + exists(Impl::getRelativeUrl(location)) } or TValidExpectation( Impl::ExpectationComment comment, string tag, string value, string knownFailure @@ -633,11 +640,7 @@ module TestPostProcessing { private string getQueryKind() { queryMetadata("kind", result) } - signature module InputSig { - string getRelativeUrl(Input::Location location); - } - - module Make Input2> { + module Make { private import InlineExpectationsTest as InlineExpectationsTest bindingset[loc] @@ -655,7 +658,7 @@ module TestPostProcessing { private string getRelativePathTo(string absolutePath) { exists(Input::Location loc | loc.hasLocationInfo(absolutePath, _, _, _, _) and - parseLocationString(Input2::getRelativeUrl(loc), result, _, _, _, _) + parseLocationString(Input::getRelativeUrl(loc), result, _, _, _, _) ) } @@ -665,7 +668,7 @@ module TestPostProcessing { exists(string data | queryResults(_, _, _, data) and parseLocationString(data, relativePath, sl, sc, el, ec) and - not Input2::getRelativeUrl(_) = data // avoid duplicate locations + not Input::getRelativeUrl(_) = data // avoid duplicate locations ) } @@ -711,7 +714,7 @@ module TestPostProcessing { LocationFromInput() { this = MkInputLocation(loc) } - override string getRelativeUrl() { result = Input2::getRelativeUrl(loc) } + override string getRelativeUrl() { result = Input::getRelativeUrl(loc) } override predicate hasLocationInfo(string file, int sl, int sc, int el, int ec) { loc.hasLocationInfo(file, sl, sc, el, ec) @@ -723,6 +726,8 @@ module TestPostProcessing { module TestImpl2 implements InlineExpectationsTestSig { final class Location = TestLocation; + string getRelativeUrl(Location location) { result = location.getRelativeUrl() } + final private class ExpectationCommentFinal = Input::ExpectationComment; class ExpectationComment extends ExpectationCommentFinal { diff --git a/swift/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/swift/ql/lib/utils/test/InlineExpectationsTestQuery.ql index a7c112bc00e0..e41d9310e0bf 100644 --- a/swift/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/swift/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import swift private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/swift/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/swift/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index b96f27c42ac2..718c118ef907 100644 --- a/swift/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/swift/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -25,4 +25,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = S::Location; + + string getRelativeUrl(Location location) { + exists(S::File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } } diff --git a/unified/ql/lib/utils/test/InlineExpectationsTestQuery.ql b/unified/ql/lib/utils/test/InlineExpectationsTestQuery.ql index 039194bc2e38..96e655dbecfb 100644 --- a/unified/ql/lib/utils/test/InlineExpectationsTestQuery.ql +++ b/unified/ql/lib/utils/test/InlineExpectationsTestQuery.ql @@ -6,16 +6,4 @@ private import unified private import codeql.util.test.InlineExpectationsTest as T private import internal.InlineExpectationsTestImpl import T::TestPostProcessing -import T::TestPostProcessing::Make - -private module Input implements T::TestPostProcessing::InputSig { - string getRelativeUrl(Location location) { - exists(File f, int startline, int startcolumn, int endline, int endcolumn | - location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and - f = location.getFile() - | - result = - f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn - ) - } -} +import T::TestPostProcessing::Make diff --git a/unified/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll b/unified/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll index b73301687412..7379e1b94e66 100644 --- a/unified/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll +++ b/unified/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll @@ -9,4 +9,14 @@ module Impl implements InlineExpectationsTestSig { } class Location = U::Location; + + string getRelativeUrl(Location location) { + exists(File f, int startline, int startcolumn, int endline, int endcolumn | + location.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and + f = location.getFile() + | + result = + f.getRelativePath() + ":" + startline + ":" + startcolumn + ":" + endline + ":" + endcolumn + ) + } }