mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Add tests for trivia types
This commit is contained in:
@@ -55,3 +55,4 @@
|
||||
| comments2.cs:118:5:118:21 | // ... | comments2.cs:119:11:119:25 | GenericClass<> | GenericClass<> |
|
||||
| comments2.cs:124:5:124:16 | // ... | comments2.cs:125:9:125:20 | GenericFn | GenericFn |
|
||||
| comments2.cs:127:20:127:23 | // ... | comments2.cs:128:9:128:17 | return ...; | x |
|
||||
| trivia.cs:1:1:3:15 | // ... | trivia.cs:14:7:14:9 | Tr1 | semmle-extractor-options: --standalone |
|
||||
|
||||
@@ -70,6 +70,9 @@ singlelineComment
|
||||
| comments2.cs:124:5:124:16 | // ... | comments2.cs:124:5:124:16 | // ... | 1 | GenericFn | // GenericFn |
|
||||
| comments2.cs:127:20:127:23 | // ... | comments2.cs:127:20:127:23 | // ... | 1 | x | // x |
|
||||
| comments2.cs:132:1:132:21 | // ... | comments2.cs:132:1:132:21 | // ... | 1 | End of comment2.cs | // End of comment2.cs |
|
||||
| trivia.cs:1:1:3:15 | // ... | trivia.cs:1:1:1:42 | // ... | 3 | semmle-extractor-options: --standalone | // semmle-extractor-options: --standalone |
|
||||
| trivia.cs:1:1:3:15 | // ... | trivia.cs:2:1:2:21 | // ... | 3 | Start of trivia.cs | // Start of trivia.cs |
|
||||
| trivia.cs:1:1:3:15 | // ... | trivia.cs:3:1:3:15 | // ... | 3 | Unassociated | // Unassociated |
|
||||
multilineComment
|
||||
| comments1.cs:11:1:11:25 | /* ... */ | comments1.cs:11:1:11:25 | /* ... */ | 1 | A multiline comment | /* A multiline comment */ |
|
||||
| comments1.cs:25:1:25:43 | /* ... */ | comments1.cs:25:1:25:15 | /* ... */ | 2 | This is a | /* This is a */ |
|
||||
|
||||
@@ -14,3 +14,4 @@
|
||||
| comments2.cs:5:27:5:41 | // ... |
|
||||
| comments2.cs:8:1:8:15 | // ... |
|
||||
| comments2.cs:132:1:132:21 | // ... |
|
||||
| trivia.cs:1:1:3:15 | // ... |
|
||||
|
||||
78
csharp/ql/test/library-tests/comments/trivia.cs
Normal file
78
csharp/ql/test/library-tests/comments/trivia.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
// semmle-extractor-options: --standalone
|
||||
// Start of trivia.cs
|
||||
// Unassociated
|
||||
#define DEBUG
|
||||
|
||||
#undef DEBUG
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#pragma warning disable 414, CS3021
|
||||
#pragma checksum "file.cs" "{406EA660-64CF-4C82-B6F0-42D48172A799}" "ab007f1d23d9" // New checksum
|
||||
class Tr1
|
||||
{
|
||||
static void M1()
|
||||
{
|
||||
#line 200 "Special"
|
||||
int i;
|
||||
int j;
|
||||
#line default
|
||||
char c;
|
||||
#pragma warning restore
|
||||
float f;
|
||||
#line hidden // numbering not affected
|
||||
string s;
|
||||
#line default
|
||||
double d;
|
||||
}
|
||||
}
|
||||
|
||||
class Tr2
|
||||
{
|
||||
static void M1()
|
||||
{
|
||||
#region fields
|
||||
int i;
|
||||
#region nested
|
||||
int j;
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
class Tr3
|
||||
{
|
||||
static void M1()
|
||||
{
|
||||
#nullable disable// Sets the nullable annotation and warning contexts to disabled.
|
||||
#nullable enable// Sets the nullable annotation and warning contexts to enabled.
|
||||
#nullable restore// Restores the nullable annotation and warning contexts to project settings.
|
||||
#nullable disable annotations// Sets the nullable annotation context to disabled.
|
||||
#nullable enable annotations// Sets the nullable annotation context to enabled.
|
||||
#nullable restore annotations// Restores the nullable annotation context to project settings.
|
||||
#nullable disable warnings// Sets the nullable warning context to disabled.
|
||||
#nullable enable warnings// Sets the nullable warning context to enabled.
|
||||
#nullable restore warnings// Restores the nullable warning context to project settings.
|
||||
}
|
||||
}
|
||||
|
||||
class Tr4
|
||||
{
|
||||
static void M1()
|
||||
{
|
||||
#if DEBUG
|
||||
#warning DEBUG is defined
|
||||
var i = 0;
|
||||
#if NESTED
|
||||
i--;
|
||||
#endif
|
||||
#elif (NOTDEBUG == true) || !(TEST)
|
||||
#error NOTDEBUG is defined or TEST is not
|
||||
var i = 1;
|
||||
#else
|
||||
var i = 2;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user