Update ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Co-authored-by: Tom Hvitved <hvitved@github.com>
This commit is contained in:
Geoffrey White
2026-06-29 15:37:45 +01:00
committed by GitHub
parent 72f1a0d89b
commit d519f79703

View File

@@ -12,22 +12,26 @@ module Impl implements InlineExpectationsTestSig {
* A class representing comments that may contain inline expectations (Ruby line comments and ERB comments).
*/
class ExpectationComment extends TAnyComment {
Ruby::Comment asRubyComment() { this = RubyComment(result) }
R::ErbComment asErbComment() { this = ErbComment(result) }
string toString() {
result = any(Ruby::Comment c | this = RubyComment(c)).toString()
result = this.asRubyComment().toString()
or
result = any(R::ErbComment c | this = ErbComment(c)).toString()
result = this.asErbComment().toString()
}
Location getLocation() {
result = any(Ruby::Comment c | this = RubyComment(c)).getLocation()
result = this.asRubyComment().getLocation()
or
result = any(R::ErbComment c | this = ErbComment(c)).getLocation()
result = this.asErbComment().getLocation()
}
string getContents() {
result = any(Ruby::Comment c | this = RubyComment(c)).getValue().suffix(1)
result = this.asRubyComment().getValue().suffix(1)
or
result = any(R::ErbComment c | this = ErbComment(c)).getValue().suffix(1)
result = this.asErbComment().getValue().suffix(1)
}
}