-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16477 from michaelnebel/csharp/madinlinetest
C#: Inline expectation for model generator test.
- Loading branch information
Showing
25 changed files
with
644 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
private import csharp as Cs | ||
private import codeql.mad.test.InlineMadTest | ||
|
||
private module InlineMadTestLang implements InlineMadTestLangSig { | ||
class Callable = Cs::Callable; | ||
|
||
string getComment(Callable c) { | ||
exists(Cs::CommentBlock block, Cs::Element after | after = block.getAfter() | | ||
( | ||
after = c or | ||
after = c.(Cs::Accessor).getDeclaration() | ||
) and | ||
result = block.getALine() | ||
) | ||
} | ||
} | ||
|
||
import InlineMadTestImpl<InlineMadTestLang> |
26 changes: 2 additions & 24 deletions
26
csharp/ql/test/utils/modelgenerator/dataflow/CaptureNeutralModels.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,2 @@ | ||
| NoSummaries;BaseClass;M1;(System.String);summary;df-generated | | ||
| NoSummaries;BaseClass;M2;(System.String);summary;df-generated | | ||
| NoSummaries;CollectionFlow;ReturnSimpleTypeArray;(System.Int32[]);summary;df-generated | | ||
| NoSummaries;CollectionFlow;ReturnSimpleTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.Int32>);summary;df-generated | | ||
| NoSummaries;CollectionFlow;ReturnSimpleTypeList;(System.Collections.Generic.List<System.Int32>);summary;df-generated | | ||
| NoSummaries;EquatableBound;Equals;(System.Object);summary;df-generated | | ||
| NoSummaries;EquatableUnBound<T>;Equals;(T);summary;df-generated | | ||
| NoSummaries;SimpleTypes;M1;(System.Boolean);summary;df-generated | | ||
| NoSummaries;SimpleTypes;M2;(System.Boolean);summary;df-generated | | ||
| NoSummaries;SimpleTypes;M3;(System.Int32);summary;df-generated | | ||
| NoSummaries;SimpleTypes;M4;(System.Int32);summary;df-generated | | ||
| Sinks;NewSinks;WrapFieldResponseWriteFile;();summary;df-generated | | ||
| Sinks;NewSinks;WrapPrivateFieldResponseWriteFile;();summary;df-generated | | ||
| Sinks;NewSinks;WrapPrivatePropResponseWriteFile;();summary;df-generated | | ||
| Sinks;NewSinks;WrapPropPrivateSetResponseWriteFile;();summary;df-generated | | ||
| Sinks;NewSinks;WrapPropResponseWriteFile;();summary;df-generated | | ||
| Sinks;NewSinks;WrapResponseWrite;(System.Object);summary;df-generated | | ||
| Sinks;NewSinks;WrapResponseWriteFile;(System.String);summary;df-generated | | ||
| Sources;NewSources;WrapConsoleReadKey;();summary;df-generated | | ||
| Sources;NewSources;WrapConsoleReadLine;();summary;df-generated | | ||
| Sources;NewSources;WrapConsoleReadLineAndProcees;(System.String);summary;df-generated | | ||
| Summaries;EqualsGetHashCodeNoFlow;Equals;(System.Object);summary;df-generated | | ||
| Summaries;EqualsGetHashCodeNoFlow;GetHashCode;();summary;df-generated | | ||
| Summaries;OperatorFlow;op_Increment;(Summaries.OperatorFlow);summary;df-generated | | ||
unexpectedModel | ||
expectedModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
csharp/ql/test/utils/modelgenerator/dataflow/CaptureNeutralModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import csharp | ||
import utils.modelgenerator.internal.CaptureSummaryFlowQuery | ||
import TestUtilities.InlineMadTest | ||
|
||
module InlineMadTestConfig implements InlineMadTestConfigSig { | ||
string getCapturedModel(Callable c) { result = captureNoFlow(c) } | ||
|
||
string getKind() { result = "neutral" } | ||
} | ||
|
||
import InlineMadTest<InlineMadTestConfig> |
1 change: 0 additions & 1 deletion
1
csharp/ql/test/utils/modelgenerator/dataflow/CaptureNeutralModels.qlref
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSinkModels.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
| Sinks;NewSinks;false;WrapFieldResponseWriteFile;();;Argument[this];html-injection;df-generated | | ||
| Sinks;NewSinks;false;WrapPropResponseWriteFile;();;Argument[this];html-injection;df-generated | | ||
| Sinks;NewSinks;false;WrapResponseWrite;(System.Object);;Argument[0];html-injection;df-generated | | ||
| Sinks;NewSinks;false;WrapResponseWriteFile;(System.String);;Argument[0];html-injection;df-generated | | ||
unexpectedModel | ||
expectedModel |
11 changes: 11 additions & 0 deletions
11
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSinkModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import csharp | ||
import utils.modelgenerator.internal.CaptureModels | ||
import TestUtilities.InlineMadTest | ||
|
||
module InlineMadTestConfig implements InlineMadTestConfigSig { | ||
string getCapturedModel(Callable c) { result = captureSink(c) } | ||
|
||
string getKind() { result = "sink" } | ||
} | ||
|
||
import InlineMadTest<InlineMadTestConfig> |
1 change: 0 additions & 1 deletion
1
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSinkModels.qlref
This file was deleted.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSourceModels.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
11 changes: 11 additions & 0 deletions
11
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSourceModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
1 change: 0 additions & 1 deletion
1
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSourceModels.qlref
This file was deleted.
Oops, something went wrong.
42 changes: 2 additions & 40 deletions
42
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSummaryModels.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,2 @@ | ||
| NoSummaries;PublicClassFlow;false;PublicReturn;(System.Object);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;BaseClassFlow;true;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnField;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnParam0;(System.String,System.Object);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnParam1;(System.String,System.Object);;Argument[1];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[1];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnSubstring;(System.String);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;BasicFlow;false;ReturnThis;(System.Object);;Argument[this];ReturnValue;value;df-generated | | ||
| Summaries;BasicFlow;false;SetField;(System.String);;Argument[0];Argument[this];taint;df-generated | | ||
| Summaries;CollectionFlow;false;AddFieldToList;(System.Collections.Generic.List<System.String>);;Argument[this];Argument[0].Element;taint;df-generated | | ||
| Summaries;CollectionFlow;false;AddToList;(System.Collections.Generic.List<System.Object>,System.Object);;Argument[1];Argument[0].Element;taint;df-generated | | ||
| Summaries;CollectionFlow;false;AssignFieldToArray;(System.Object[]);;Argument[this];Argument[0].Element;taint;df-generated | | ||
| Summaries;CollectionFlow;false;AssignToArray;(System.Object,System.Object[]);;Argument[0];Argument[1].Element;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnArrayElement;(System.Object[]);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnBulkTypeList;(System.Collections.Generic.List<System.Byte>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnComplexTypeArray;(System.String[]);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnComplexTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.String>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnFieldInAList;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnListElement;(System.Collections.Generic.List<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnUntypedArray;(System.Array);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;CollectionFlow;false;ReturnUntypedList;(System.Collections.IList);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;DerivedClass1Flow;false;ReturnParam1;(System.String,System.String);;Argument[1];ReturnValue;taint;df-generated | | ||
| Summaries;DerivedClass2Flow;false;ReturnParam0;(System.String,System.Int32);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;DerivedClass2Flow;false;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;EqualsGetHashCodeNoFlow;false;Equals;(System.String);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;AddFieldToGenericList;(System.Collections.Generic.List<T>);;Argument[this];Argument[0].Element;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;AddToGenericList<S>;(System.Collections.Generic.List<S>,S);;Argument[1];Argument[0].Element;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;ReturnFieldInGenericList;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;ReturnGenericElement<S>;(System.Collections.Generic.List<S>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;ReturnGenericField;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;ReturnGenericParam<S>;(S);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;GenericFlow<T>;false;SetGenericField;(T);;Argument[0];Argument[this];taint;df-generated | | ||
| Summaries;IEnumerableFlow;false;ReturnFieldInIEnumerable;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;IEnumerableFlow;false;ReturnIEnumerable;(System.Collections.Generic.IEnumerable<System.String>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;IEnumerableFlow;false;ReturnIEnumerableElement;(System.Collections.Generic.IEnumerable<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated | | ||
| Summaries;OperatorFlow;false;OperatorFlow;(System.Object);;Argument[0];Argument[this];taint;df-generated | | ||
| Summaries;OperatorFlow;false;op_Addition;(Summaries.OperatorFlow,Summaries.OperatorFlow);;Argument[0];ReturnValue;taint;df-generated | | ||
| Summaries;Properties;false;get_Prop1;();;Argument[this];ReturnValue;taint;df-generated | | ||
| Summaries;Properties;false;set_Prop2;(System.String);;Argument[0];Argument[this];taint;df-generated | | ||
unexpectedModel | ||
expectedModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSummaryModels.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import csharp | ||
import utils.modelgenerator.internal.CaptureSummaryFlowQuery | ||
import TestUtilities.InlineMadTest | ||
|
||
module InlineMadTestConfig implements InlineMadTestConfigSig { | ||
string getCapturedModel(Callable c) { result = captureFlow(c) } | ||
|
||
string getKind() { result = "summary" } | ||
} | ||
|
||
import InlineMadTest<InlineMadTestConfig> |
1 change: 0 additions & 1 deletion
1
csharp/ql/test/utils/modelgenerator/dataflow/CaptureSummaryModels.qlref
This file was deleted.
Oops, something went wrong.
174 changes: 0 additions & 174 deletions
174
csharp/ql/test/utils/modelgenerator/dataflow/NoSummaries.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.