The following query tags classes that inherit XCTestCase as swift_xctest_class, but only if subclassed directly. In our codebase, we have our own base test case class that subclasses XCTestCase, and all of our tests subclass that (and sometimes even deeper).
|
;; XCTestCase subclass |
|
( |
|
(class_declaration |
|
name: (type_identifier) @SWIFT_TEST_CLASS |
|
(inheritance_specifier |
|
inherits_from: (user_type |
|
(type_identifier) @run (#eq? @run "XCTestCase") |
|
) |
|
) |
|
) @_swift-xctest-class |
|
(#set! tag swift-xctest-class) |
|
) |
I don't know much about treesitter scm. Is there a way to modify this query so that my test case classes are tagged with swift_xctest_class?
The following query tags classes that inherit
XCTestCaseasswift_xctest_class, but only if subclassed directly. In our codebase, we have our own base test case class that subclassesXCTestCase, and all of our tests subclass that (and sometimes even deeper).swift/languages/swift/runnables.scm
Lines 60 to 71 in e91e66b
I don't know much about treesitter scm. Is there a way to modify this query so that my test case classes are tagged with
swift_xctest_class?