Skip to content

Commit fe9d879

Browse files
committed
Prettify tests
1 parent 4c5344d commit fe9d879

File tree

2 files changed

+13
-14
lines changed
  • go/ql/test/library-tests/semmle/go/aliases

2 files changed

+13
-14
lines changed

go/ql/test/library-tests/semmle/go/aliases/MethodDefs/test.ql

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ newtype TEntityWithDeclInfo =
44
MkEntityWithDeclInfo(Entity e, int nDecls) { nDecls = count(e.getDeclaration()) and nDecls > 0 }
55

66
class EntityWithDeclInfo extends TEntityWithDeclInfo {
7-
string toString() {
8-
exists(Entity e, int nDecls | this = MkEntityWithDeclInfo(e, nDecls) |
9-
result = e.toString() + " (" + nDecls + " declaration sites)"
10-
)
11-
}
7+
Entity e;
8+
int nDecls;
9+
10+
EntityWithDeclInfo() { this = MkEntityWithDeclInfo(e, nDecls) }
11+
12+
string toString() { result = e.toString() + " (" + nDecls + " declaration sites)" }
1213

1314
predicate hasLocationInfo(
1415
string filepath, int startline, int startcolumn, int endline, int endcolumn
1516
) {
16-
exists(Entity e | this = MkEntityWithDeclInfo(e, _) |
17-
e.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
18-
)
17+
e.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
1918
}
2019
}
2120

go/ql/test/library-tests/semmle/go/aliases/defsuses/test.ql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import go
33
newtype TEntityWithDeclInfo = MkEntityWithDeclInfo(Entity e)
44

55
class EntityWithDeclInfo extends TEntityWithDeclInfo {
6+
Entity e;
7+
8+
EntityWithDeclInfo() { this = MkEntityWithDeclInfo(e) }
9+
610
string toString() {
7-
exists(Entity e | this = MkEntityWithDeclInfo(e) |
8-
result = e.toString() + " (" + count(e.getDeclaration()) + " declaration sites)"
9-
)
11+
result = e.toString() + " (" + count(e.getDeclaration()) + " declaration sites)"
1012
}
1113

1214
predicate hasLocationInfo(
1315
string filepath, int startline, int startcolumn, int endline, int endcolumn
1416
) {
15-
exists(Entity e | this = MkEntityWithDeclInfo(e) |
16-
e.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
17-
)
17+
e.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
1818
}
1919
}
2020

0 commit comments

Comments
 (0)