Skip to content

Commit

Permalink
Add region test
Browse files Browse the repository at this point in the history
  • Loading branch information
alrz committed Jul 2, 2021
1 parent 76ec83b commit 3c2e686
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,29 @@ public static void Main(string[] args)
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.UnsafeAddressTaken));
}

[Fact]
public void RegionInIsPattern05()
{
var dataFlowAnalysisResults = CompileAndAnalyzeDataFlowExpression(
@"class Program
{
public static void Main(string[] args)
{
if (/*<bind>*/args is [] i/*</bind>*/) {}
}
}");
Assert.Equal("i", GetSymbolNamesJoined(dataFlowAnalysisResults.VariablesDeclared));
Assert.Equal("args", GetSymbolNamesJoined(dataFlowAnalysisResults.DataFlowsIn));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.DataFlowsOut));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.AlwaysAssigned));
Assert.Equal("args", GetSymbolNamesJoined(dataFlowAnalysisResults.ReadInside));
Assert.Equal("i", GetSymbolNamesJoined(dataFlowAnalysisResults.WrittenInside));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.ReadOutside));
Assert.Equal("args", GetSymbolNamesJoined(dataFlowAnalysisResults.WrittenOutside));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.Captured));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.CapturedInside));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.CapturedOutside));
Assert.Null(GetSymbolNamesJoined(dataFlowAnalysisResults.UnsafeAddressTaken));
}
}
}

0 comments on commit 3c2e686

Please sign in to comment.