C#: Convert source capture test to inline expectation.

This commit is contained in:
Michael Nebel
2024-05-13 13:08:29 +02:00
parent 404b39b6e6
commit 26f9297d62
4 changed files with 17 additions and 5 deletions

View File

@@ -1,3 +1,2 @@
| Sources;NewSources;false;WrapConsoleReadKey;();;ReturnValue;local;df-generated |
| Sources;NewSources;false;WrapConsoleReadLine;();;ReturnValue;local;df-generated |
| Sources;NewSources;false;WrapConsoleReadLineAndProcees;(System.String);;ReturnValue;local;df-generated |
unexpectedModel
expectedModel

View File

@@ -0,0 +1,11 @@
import csharp
import utils.modelgenerator.internal.CaptureModels
import TestUtilities.InlineMadTest
module InlineMadTestConfig implements InlineMadTestConfigSig {
string getCapturedModel(Callable c) { result = captureSource(c) }
string getKind() { result = "source" }
}
import InlineMadTest<InlineMadTestConfig>

View File

@@ -1 +0,0 @@
utils/modelgenerator/CaptureSourceModels.ql

View File

@@ -5,12 +5,14 @@ namespace Sources;
public class NewSources
{
// New source
// source=Sources;NewSources;false;WrapConsoleReadLine;();;ReturnValue;local;df-generated
public string? WrapConsoleReadLine()
{
return Console.ReadLine();
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadLineAndProcees;(System.String);;ReturnValue;local;df-generated
public string WrapConsoleReadLineAndProcees(string prompt)
{
var s = Console.ReadLine();
@@ -24,8 +26,9 @@ public class NewSources
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadKey;();;ReturnValue;local;df-generated
public ConsoleKeyInfo WrapConsoleReadKey()
{
return Console.ReadKey();
}
}
}