Skip to content

Commit 0262e78

Browse files
committed
Remove unnecessary test code
1 parent bea72f9 commit 0262e78

File tree

3 files changed

+8
-67
lines changed

3 files changed

+8
-67
lines changed

components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.SourceGenerators/Constants/WellKnownTrackingNames.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ internal static class WellKnownTrackingNames
1414
/// </summary>
1515
public const string Execute = nameof(Execute);
1616

17-
/// <summary>
18-
/// The filtered transform with just output diagnostics.
19-
/// </summary>
20-
public const string Diagnostics = nameof(Diagnostics);
21-
2217
/// <summary>
2318
/// The filtered transform with just output sources.
2419
/// </summary>

components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.Tests/Helpers/CSharpGeneratorTest{TGenerator}.cs

Lines changed: 8 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,14 @@ public static void VerifySources(string source, (string Filename, string Source)
7676
/// <param name="source">The input source to process.</param>
7777
/// <param name="updatedSource">The updated source to process.</param>
7878
/// <param name="executeReason">The reason for the first <c>"Execute"</c> step.</param>
79-
/// <param name="diagnosticsReason">The reason for the <c>"Diagnostics"</c> step.</param>
8079
/// <param name="outputReason">The reason for the <c>"Output"</c> step.</param>
81-
/// <param name="diagnosticsSourceReason">The reason for the output step for the diagnostics.</param>
8280
/// <param name="sourceReason">The reason for the final output source.</param>
8381
/// <param name="languageVersion">The language version to use to run the test.</param>
8482
public static void VerifyIncrementalSteps(
8583
string source,
8684
string updatedSource,
8785
IncrementalStepRunReason executeReason,
88-
IncrementalStepRunReason? diagnosticsReason,
8986
IncrementalStepRunReason outputReason,
90-
IncrementalStepRunReason? diagnosticsSourceReason,
9187
IncrementalStepRunReason sourceReason,
9288
LanguageVersion languageVersion = LanguageVersion.CSharp13)
9389
{
@@ -110,61 +106,17 @@ public static void VerifyIncrementalSteps(
110106

111107
GeneratorRunResult result = driver.GetRunResult().Results.Single();
112108

113-
// Get the generated sources and validate them. We have two possible cases: if no diagnostics
114-
// are produced, then just the output source node is triggered. Otherwise, we'll also have one
115-
// output node which is used to emit the gathered diagnostics from the initial transform step.
116-
if (diagnosticsSourceReason is not null)
117-
{
118-
Assert.AreEqual(
119-
expected: 2,
120-
actual:
121-
result.TrackedOutputSteps
122-
.SelectMany(outputStep => outputStep.Value)
123-
.SelectMany(output => output.Outputs)
124-
.Count());
125-
126-
// The "Diagnostics" name has one more parent compared to "Output", because it also
127-
// has one extra Where(...) call on the node (used to filter out empty diagnostics).
128-
Assert.AreEqual(
129-
expected: diagnosticsSourceReason,
130-
actual:
131-
result.TrackedOutputSteps
132-
.Single().Value
133-
.Single(run => run.Inputs[0].Source.Inputs[0].Source.Name == "Diagnostics")
134-
.Outputs.Single().Reason);
135-
136-
Assert.AreEqual(
137-
expected: sourceReason,
138-
actual:
139-
result.TrackedOutputSteps
140-
.Single().Value
141-
.Single(run => run.Inputs[0].Source.Name == "Output")
142-
.Outputs.Single().Reason);
143-
}
144-
else
145-
{
146-
(object Value, IncrementalStepRunReason Reason)[] sourceOuputs =
147-
result.TrackedOutputSteps
148-
.SelectMany(outputStep => outputStep.Value)
149-
.SelectMany(output => output.Outputs)
150-
.ToArray();
151-
152-
Assert.AreEqual(1, sourceOuputs.Length);
153-
Assert.AreEqual(sourceReason, sourceOuputs[0].Reason);
154-
}
109+
// Get the generated sources and validate them
110+
(object Value, IncrementalStepRunReason Reason)[] sourceOuputs =
111+
result.TrackedOutputSteps
112+
.SelectMany(outputStep => outputStep.Value)
113+
.SelectMany(output => output.Outputs)
114+
.ToArray();
155115

116+
Assert.AreEqual(1, sourceOuputs.Length);
117+
Assert.AreEqual(sourceReason, sourceOuputs[0].Reason);
156118
Assert.AreEqual(executeReason, result.TrackedSteps["Execute"].Single().Outputs[0].Reason);
157119
Assert.AreEqual(outputReason, result.TrackedSteps["Output"].Single().Outputs[0].Reason);
158-
159-
// Check the diagnostics reason, which might not be present
160-
if (diagnosticsReason is not null)
161-
{
162-
Assert.AreEqual(diagnosticsReason, result.TrackedSteps["Diagnostics"].Single().Outputs[0].Reason);
163-
}
164-
else
165-
{
166-
Assert.IsFalse(result.TrackedSteps.ContainsKey("Diagnostics"));
167-
}
168120
}
169121

170122
/// <summary>

components/DependencyPropertyGenerator/CommunityToolkit.DependencyPropertyGenerator.Tests/Test_DependencyPropertyGenerator_Incrementality.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ public partial class MyControl : DependencyObject
4545
source,
4646
updatedSource,
4747
executeReason: IncrementalStepRunReason.Modified,
48-
diagnosticsReason: null,
4948
outputReason: IncrementalStepRunReason.Modified,
50-
diagnosticsSourceReason: null,
5149
sourceReason: IncrementalStepRunReason.Modified);
5250
}
5351

@@ -87,9 +85,7 @@ public partial class MyControl : DependencyObject
8785
source,
8886
updatedSource,
8987
executeReason: IncrementalStepRunReason.Unchanged,
90-
diagnosticsReason: null,
9188
outputReason: IncrementalStepRunReason.Cached,
92-
diagnosticsSourceReason: null,
9389
sourceReason: IncrementalStepRunReason.Cached);
9490
}
9591

@@ -130,9 +126,7 @@ public void Foo()
130126
source,
131127
updatedSource,
132128
executeReason: IncrementalStepRunReason.Unchanged,
133-
diagnosticsReason: null,
134129
outputReason: IncrementalStepRunReason.Cached,
135-
diagnosticsSourceReason: null,
136130
sourceReason: IncrementalStepRunReason.Cached);
137131
}
138132
}

0 commit comments

Comments
 (0)