mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C#: Add test for global using directive.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
global using System;
|
||||
global using System.IO;
|
||||
global using static System.Text.Encoding;
|
||||
9
csharp/ql/test/library-tests/csharp10/global/MyClass1.cs
Normal file
9
csharp/ql/test/library-tests/csharp10/global/MyClass1.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections;
|
||||
|
||||
public class MyClass1
|
||||
{
|
||||
public void HelloWorld()
|
||||
{
|
||||
Console.WriteLine("Hello World");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
globalUsing
|
||||
| GlobalUsing.cs:1:1:1:20 | using ...; |
|
||||
| GlobalUsing.cs:2:1:2:23 | using ...; |
|
||||
| GlobalUsing.cs:3:1:3:41 | using static ...; |
|
||||
localUsing
|
||||
| MyClass1.cs:1:1:1:25 | using ...; |
|
||||
globalUsingNamespace
|
||||
| GlobalUsing.cs:1:1:1:20 | using ...; | file://:0:0:0:0 | System |
|
||||
| GlobalUsing.cs:2:1:2:23 | using ...; | file://:0:0:0:0 | System.IO |
|
||||
10
csharp/ql/test/library-tests/csharp10/global/globalUsing.ql
Normal file
10
csharp/ql/test/library-tests/csharp10/global/globalUsing.ql
Normal file
@@ -0,0 +1,10 @@
|
||||
import csharp
|
||||
|
||||
query predicate globalUsing(UsingDirective und) { und.isGlobal() }
|
||||
|
||||
query predicate localUsing(UsingDirective ud) { not ud.isGlobal() }
|
||||
|
||||
query predicate globalUsingNamespace(UsingNamespaceDirective und, Namespace namespace) {
|
||||
und.isGlobal() and
|
||||
namespace = und.getImportedNamespace()
|
||||
}
|
||||
Reference in New Issue
Block a user