Skip to content

Commit 658cc33

Browse files
authored
Merge pull request github#12212 from hvitved/util/inline-expect-test-use-end-line
Util: Use end line instead of start line for actual results
2 parents 9aea725 + 879eff4 commit 658cc33

File tree

21 files changed

+94
-94
lines changed

21 files changed

+94
-94
lines changed

go/ql/test/library-tests/semmle/go/Types/variadicFunctions.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ func testing() {
77
nonvariadicDeclaredFunction([]int{})
88
}
99

10-
func variadicDeclaredFunction(x ...int) int { // $ isVariadic
10+
func variadicDeclaredFunction(x ...int) int {
1111
a := make([]int, 0, 10)
1212
y := append(x, a...)
1313
print(x[0], x[1])
1414
println(x[0], x[1])
1515
fmt.Fprint(nil, nil, nil)
1616
variadicFunctionLiteral := func(z ...int) int { return z[1] } // $ isVariadic
1717
return variadicFunctionLiteral(y...)
18-
}
18+
} // $ isVariadic
1919

2020
func nonvariadicDeclaredFunction(x []int) int {
2121
return 0

go/ql/test/library-tests/semmle/go/concepts/HTTP/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func main() {
5959

6060
http.HandleFunc("/foo", handler) // $ handler="/foo"
6161

62-
http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) { // $ handler="/bar"
62+
http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
6363
fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
64-
})
64+
}) // $ handler="/bar"
6565
}

java/ql/test/library-tests/frameworks/apache-commons-lang3/StrBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void test() throws Exception {
145145

146146
// Test all fluent methods are passing taint through to their result:
147147
StrBuilder fluentAllMethodsTest = new StrBuilder(taint());
148-
sink(fluentAllMethodsTest // $hasTaintFlow
148+
sink(fluentAllMethodsTest
149149
.append("text")
150150
.appendAll("text")
151151
.appendFixedWidthPadLeft("text", 4, ' ')
@@ -171,7 +171,7 @@ void test() throws Exception {
171171
.setLength(500)
172172
.setNewLineText("newline")
173173
.setNullText("NULL")
174-
.trim());
174+
.trim()); // $hasTaintFlow
175175

176176
// Test all fluent methods are passing taint back to their qualifier:
177177
StrBuilder fluentAllMethodsTest2 = new StrBuilder();

java/ql/test/library-tests/frameworks/apache-commons-lang3/StrBuilderTextTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void test() throws Exception {
145145

146146
// Test all fluent methods are passing taint through to their result:
147147
StrBuilder fluentAllMethodsTest = new StrBuilder(taint());
148-
sink(fluentAllMethodsTest // $hasTaintFlow
148+
sink(fluentAllMethodsTest
149149
.append("text")
150150
.appendAll("text")
151151
.appendFixedWidthPadLeft("text", 4, ' ')
@@ -171,7 +171,7 @@ void test() throws Exception {
171171
.setLength(500)
172172
.setNewLineText("newline")
173173
.setNullText("NULL")
174-
.trim());
174+
.trim()); // $hasTaintFlow
175175

176176
// Test all fluent methods are passing taint back to their qualifier:
177177
StrBuilder fluentAllMethodsTest2 = new StrBuilder();

java/ql/test/library-tests/frameworks/apache-commons-lang3/TextStringBuilderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void test() throws Exception {
146146

147147
// Test all fluent methods are passing taint through to their result:
148148
TextStringBuilder fluentAllMethodsTest = new TextStringBuilder(taint());
149-
sink(fluentAllMethodsTest // $hasTaintFlow
149+
sink(fluentAllMethodsTest
150150
.append("text")
151151
.appendAll("text")
152152
.appendFixedWidthPadLeft("text", 4, ' ')
@@ -172,7 +172,7 @@ void test() throws Exception {
172172
.setLength(500)
173173
.setNewLineText("newline")
174174
.setNullText("NULL")
175-
.trim());
175+
.trim()); // $hasTaintFlow
176176

177177
// Test all fluent methods are passing taint back to their qualifier:
178178
TextStringBuilder fluentAllMethodsTest2 = new TextStringBuilder();

java/ql/test/query-tests/security/CWE-079/semmle/tests/JsfXSS.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public void encodeBegin(FacesContext facesContext, UIComponent component) throws
2424
ResponseWriter writer = facesContext.getResponseWriter();
2525
writer.write("<script type=\"text/javascript\">");
2626
writer.write("(function(){");
27-
writer.write("dswh.init('" + windowId + "','" // $xss
27+
writer.write("dswh.init('" + windowId + "','"
2828
+ "......" + "',"
29-
+ -1 + ",{");
29+
+ -1 + ",{"); // $xss
3030
writer.write("});");
3131
writer.write("})();");
3232
writer.write("</script>");

java/ql/test/query-tests/security/CWE-489/debuggable-attribute/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.example.happybirthday">
55

6-
<!-- $ hasDebuggableAttributeEnabled --> <application
6+
<application
77
android:debuggable="true"
88
android:allowBackup="true"
99
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -13,7 +13,7 @@
1313
android:roundIcon="@mipmap/ic_launcher_round"
1414
android:supportsRtl="true"
1515
android:theme="@style/Theme.HappyBirthday"
16-
tools:targetApi="31">
16+
tools:targetApi="31"> <!-- $ hasDebuggableAttributeEnabled -->
1717
<activity
1818
android:name=".MainActivity"
1919
android:exported="true">

java/ql/test/query-tests/security/CWE-489/debuggable-attribute/Testbuild/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
package="com.example.happybirthday">
55

6-
<!-- Safe: manifest file located in build directory --> <application
6+
<application
77
android:debuggable="true"
88
android:allowBackup="true"
99
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -13,7 +13,7 @@
1313
android:roundIcon="@mipmap/ic_launcher_round"
1414
android:supportsRtl="true"
1515
android:theme="@style/Theme.HappyBirthday"
16-
tools:targetApi="31">
16+
tools:targetApi="31"> <!-- Safe: manifest file located in build directory -->
1717
<activity
1818
android:name=".MainActivity"
1919
android:exported="true">

java/ql/test/query-tests/security/CWE-524/res/layout/Test.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
xmlns:app="http://schemas.android.com/apk/res-auto">
55

66

7-
<!-- $hasResult --> <EditText
7+
<EditText
88
android:id="@+id/test1_password"
9-
android:inputType="text"/>
9+
android:inputType="text"/> <!-- $hasResult -->
1010

1111
<EditText
1212
android:id="@+id/test2_safe"
@@ -20,12 +20,12 @@
2020
android:id="@+id/test4_password"
2121
android:inputType="textPassword"/>
2222

23-
<!-- $hasResult --> <EditText
23+
<EditText
2424
android:id="@+id/test5_bank_account_name"
25-
android:inputType="textMultiLine"/>
25+
android:inputType="textMultiLine"/> <!-- $hasResult -->
2626

27-
<!-- $hasResult --> <EditText
28-
android:id="@+id/test6_password"/>
27+
<EditText
28+
android:id="@+id/test6_password"/> <!-- $hasResult -->
2929

3030
<EditText
3131
android:id="@+id/test7_password"/>

java/ql/test/query-tests/security/CWE-926/AndroidManifest.xml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,100 +14,100 @@
1414
android:theme="@style/Theme.HappyBirthday"
1515
tools:targetApi="31">
1616

17-
<!-- $ hasImplicitExport --> <activity
17+
<activity
1818
android:name=".Activity">
1919
<intent-filter>
2020
<action android:name="android.intent.action.VIEW" />
2121
</intent-filter>
22-
</activity>
22+
</activity> <!-- $ hasImplicitExport -->
2323

24-
<!-- $ hasImplicitExport --> <receiver
24+
<receiver
2525
android:name=".CheckInstall">
2626
<intent-filter>
2727
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
2828

2929
</intent-filter>
30-
</receiver>
30+
</receiver> <!-- $ hasImplicitExport -->
3131

32-
<!-- $ hasImplicitExport --> <service
32+
<service
3333
android:name=".backgroundService">
3434
<intent-filter>
3535
<action android:name="android.intent.action.START_BACKGROUND"/>
3636

3737
</intent-filter>
38-
</service>
38+
</service> <!-- $ hasImplicitExport -->
3939

40-
<!-- $ hasImplicitExport --> <provider
40+
<provider
4141
android:name=".MyCloudProvider">
4242
<intent-filter>
4343
<action android:name="android.intent.action.DOCUMENTS_PROVIDER"/>
4444

4545
</intent-filter>
46-
</provider>
46+
</provider> <!-- $ hasImplicitExport -->
4747

48-
<!-- Safe: 'android:exported' explicitly set --> <activity
48+
<activity
4949
android:name=".Activity"
5050
android:exported="true">
5151
<intent-filter>
5252
<action android:name="android.intent.action.VIEW" />
5353
</intent-filter>
54-
</activity>
54+
</activity> <!-- Safe: 'android:exported' explicitly set -->
5555

56-
<!-- Safe: no intent filter --> <activity
56+
<activity
5757
android:name=".Activity">
58-
</activity>
58+
</activity> <!-- Safe: no intent filter -->
5959

60-
<!-- Safe: has 'permission' attribute --> <activity
60+
<activity
6161
android:name=".Activity"
6262
android:permission=".Test">
6363
<intent-filter>
6464
<action android:name="android.intent.action.VIEW" />
6565
</intent-filter>
66-
</activity>
66+
</activity> <!-- Safe: has 'permission' attribute -->
6767

68-
<!-- Safe: 'provider' with read and write permissions set --> <provider
68+
<provider
6969
android:name=".MyCloudProvider"
7070
android:readPermission=".TestRead"
7171
android:writePermission=".TestWrite">
7272
<intent-filter>
7373
<action android:name="android.intent.action.DOCUMENTS_PROVIDER"/>
7474

7575
</intent-filter>
76-
</provider>
76+
</provider> <!-- Safe: 'provider' with read and write permissions set -->
7777

78-
<!-- $ hasImplicitExport --> <provider
78+
<provider
7979
android:name=".MyCloudProvider"
8080
android:readPermission=".TestRead">
8181
<intent-filter>
8282
<action android:name="android.intent.action.DOCUMENTS_PROVIDER"/>
8383

8484
</intent-filter>
85-
</provider>
85+
</provider> <!-- $ hasImplicitExport -->
8686

87-
<!-- $ hasImplicitExport --> <provider
87+
<provider
8888
android:name=".MyCloudProvider"
8989
android:writePermission=".TestWrite">
9090
<intent-filter>
9191
<action android:name="android.intent.action.DOCUMENTS_PROVIDER"/>
9292

9393
</intent-filter>
94-
</provider>
94+
</provider> <!-- $ hasImplicitExport -->
9595

96-
<!-- Safe: has category 'android.intent.category.LAUNCHER' --> <activity
96+
<activity
9797
android:name=".Activity">
9898
<intent-filter>
9999
<action android:name="android.intent.action.MAIN" />
100100

101101
<category android:name="android.intent.category.LAUNCHER" />
102102
</intent-filter>
103-
</activity>
103+
</activity> <!-- Safe: has category 'android.intent.category.LAUNCHER' -->
104104

105-
<!-- Safe: has action 'android.intent.category.MAIN' --> <activity
105+
<activity
106106
android:name=".Activity">
107107
<intent-filter>
108108
<action android:name="android.intent.action.MAIN" />
109109
</intent-filter>
110-
</activity>
110+
</activity> <!-- Safe: has action 'android.intent.category.MAIN' -->
111111

112112
</application>
113113

0 commit comments

Comments
 (0)