Skip to content

Commit a1eff16

Browse files
committed
C#: Add test for global using directive.
1 parent c118d9b commit a1eff16

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
global using System;
2+
global using System.IO;
3+
global using static System.Text.Encoding;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Collections;
2+
3+
public class MyClass1
4+
{
5+
public void HelloWorld()
6+
{
7+
Console.WriteLine("Hello World");
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
globalUsing
2+
| GlobalUsing.cs:1:1:1:20 | using ...; |
3+
| GlobalUsing.cs:2:1:2:23 | using ...; |
4+
| GlobalUsing.cs:3:1:3:41 | using static ...; |
5+
localUsing
6+
| MyClass1.cs:1:1:1:25 | using ...; |
7+
globalUsingNamespace
8+
| GlobalUsing.cs:1:1:1:20 | using ...; | file://:0:0:0:0 | System |
9+
| GlobalUsing.cs:2:1:2:23 | using ...; | file://:0:0:0:0 | System.IO |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import csharp
2+
3+
query predicate globalUsing(UsingDirective und) { und.isGlobal() }
4+
5+
query predicate localUsing(UsingDirective ud) { not ud.isGlobal() }
6+
7+
query predicate globalUsingNamespace(UsingNamespaceDirective und, Namespace namespace) {
8+
und.isGlobal() and
9+
namespace = und.getImportedNamespace()
10+
}

0 commit comments

Comments
 (0)