@@ -2,47 +2,53 @@ import java
22
33private signature module InlineMadTestLangSig {
44 /**
5- * Gets a relevant code comment, if any.
5+ * Gets a relevant code comment for `c` , if any.
66 */
7- string getComment ( ) ;
7+ string getComment ( Callable c ) ;
88}
99
1010signature module InlineMadTestConfigSig {
1111 /**
12- * Gets the kind of the captured model.
12+ * Gets the kind of a captured model.
1313 */
1414 string getKind ( ) ;
1515
1616 /**
17- * Gets a captured model, if any.
17+ * Gets a captured model for `c` , if any.
1818 */
19- string getCapturedModel ( ) ;
19+ string getCapturedModel ( Callable c ) ;
2020}
2121
2222private module InlineMadTestImpl< InlineMadTestLangSig Lang, InlineMadTestConfigSig Input> {
23- private string expects ( ) {
24- Lang:: getComment ( ) .regexpCapture ( " *(SPURIOUS-)?" + Input:: getKind ( ) + "=(.*)" , 2 ) = result
23+ private string expects ( Callable c ) {
24+ Lang:: getComment ( c ) .regexpCapture ( " *(SPURIOUS-)?" + Input:: getKind ( ) + "=(.*)" , 2 ) = result
2525 }
2626
2727 query predicate unexpectedModel ( string msg ) {
28- exists ( string flow |
29- flow = Input:: getCapturedModel ( ) and
30- not flow = expects ( ) and
28+ exists ( Callable c , string flow |
29+ flow = Input:: getCapturedModel ( c ) and
30+ not flow = expects ( c ) and
3131 msg = "Unexpected " + Input:: getKind ( ) + " found: " + flow
3232 )
3333 }
3434
3535 query predicate expectedModel ( string msg ) {
36- exists ( string e |
37- e = expects ( ) and
38- not e = Input:: getCapturedModel ( ) and
36+ exists ( Callable c , string e |
37+ e = expects ( c ) and
38+ not e = Input:: getCapturedModel ( c ) and
3939 msg = "Expected " + Input:: getKind ( ) + " missing: " + e
4040 )
4141 }
4242}
4343
4444private module InlineMadTestLang implements InlineMadTestLangSig {
45- string getComment ( ) { result = any ( Javadoc doc ) .getChild ( 0 ) .toString ( ) }
45+ string getComment ( Callable c ) {
46+ exists ( Javadoc doc |
47+ hasJavadoc ( c , doc ) and
48+ isNormalComment ( doc ) and
49+ result = doc .getChild ( 0 ) .toString ( )
50+ )
51+ }
4652}
4753
4854module InlineMadTest< InlineMadTestConfigSig Input> {
0 commit comments