Skip to content

Commit 23b8444

Browse files
committed
C#: Cleanup C# source code file and add a test case for namespace delcarations.
1 parent b8f6d17 commit 23b8444

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
namespace MyFileScopedNamespace;
2+
23
public class MyFileScopedNamespaceClass
34
{
45
private readonly object myField = new object();
56
public object MyProp { get; set; }
67
public void MyMethod() { }
7-
88
}
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:2:14:2:39 | MyFileScopedNamespaceClass |
2-
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:4:29:4:35 | myField |
3-
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:5:19:5:24 | MyProp |
4-
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:6:17:6:24 | MyMethod |
1+
fileScopedNamespace
2+
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:3:14:3:39 | MyFileScopedNamespaceClass |
3+
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:5:29:5:35 | myField |
4+
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:6:19:6:24 | MyProp |
5+
| FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace | FileScopedNamespace.cs:7:17:7:24 | MyMethod |
6+
namespaceDeclaration
7+
| FileScopedNamespace.cs:1:11:1:31 | namespace ... { ... } | FileScopedNamespace.cs:1:11:1:31 | MyFileScopedNamespace |

csharp/ql/test/library-tests/csharp10/fileScopedNamespace.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ query predicate fileScopedNamespace(Namespace n, Member m) {
88
m.getLocation().toString().matches("%FileScopedNamespace.cs%")
99
)
1010
}
11+
12+
query predicate namespaceDeclaration(NamespaceDeclaration nd, Namespace n) { n = nd.getNamespace() }

0 commit comments

Comments
 (0)