Skip to content

Commit 4d3e283

Browse files
Use different scopes to ensure apps won't mix again
1 parent 695cc1a commit 4d3e283

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

test/CommandLineUtils.Tests/CommandLineProcessorTests.cs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,28 @@ private class ShortNameType
130130
[Fact]
131131
public void ItInfersClusterOptionsCannotBeUsed()
132132
{
133-
var app1 = new CommandLineApplication();
134-
app1.Option("-au|--auth", "Verbose output", CommandOptionType.NoValue);
135-
app1.Parse();
136-
Assert.False(app1.ClusterOptions);
137-
138-
var app2 = new CommandLineApplication();
139-
app2.Command("sub", c => c.Option("-au|--auth", "Verbose output", CommandOptionType.NoValue));
140-
Assert.False(app2.ClusterOptionsWasSetExplicitly);
141-
app2.Parse();
142-
Assert.False(app2.ClusterOptions);
143-
144-
var app3 = new CommandLineApplication<ShortNameType>();
145-
app3.Conventions.UseDefaultConventions();
146-
Assert.False(app3.ClusterOptionsWasSetExplicitly);
147-
app3.Parse();
148-
Assert.False(app3.ClusterOptions);
133+
{
134+
var app = new CommandLineApplication();
135+
app.Option("-au|--auth", "Verbose output", CommandOptionType.NoValue);
136+
app.Parse();
137+
Assert.False(app.ClusterOptions);
138+
}
139+
140+
{
141+
var app = new CommandLineApplication();
142+
app.Command("sub", c => c.Option("-au|--auth", "Verbose output", CommandOptionType.NoValue));
143+
Assert.False(app.ClusterOptionsWasSetExplicitly);
144+
app.Parse();
145+
Assert.False(app.ClusterOptions);
146+
}
147+
148+
{
149+
var app = new CommandLineApplication<ShortNameType>();
150+
app.Conventions.UseDefaultConventions();
151+
Assert.False(app.ClusterOptionsWasSetExplicitly);
152+
app.Parse();
153+
Assert.False(app.ClusterOptions);
154+
}
149155
}
150156

151157
[Fact]

0 commit comments

Comments
 (0)