Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/BenchmarkDotNet/ConsoleArguments/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,7 @@ private static (bool Success, string[] ExpandedTokens) ExpandResponseFile(string
}
else
{
if (arg.Contains(' '))
{
// Workaround for CommandLine library issue with parsing these kind of args.
result.Add(" " + arg);
}
else
{
result.Add(arg);
}
result.Add(arg);
}
}

Expand Down
17 changes: 16 additions & 1 deletion tests/BenchmarkDotNet.Tests/ConfigParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public void UsersCanSpecifyWithoutOverheadEvalution()
}
}

[Fact]
[Fact(Skip = "This should be handled somehow at CommandLineParser level. See https://github.com/commandlineparser/commandline/pull/892")]
public void UserCanSpecifyWasmArgs()
{
var parsedConfiguration = ConfigParser.Parse(new[] { "--runtimes", "wasm", "--wasmArgs", "--expose_wasm --module" }, new OutputLogger(Output));
Expand All @@ -600,6 +600,19 @@ public void UserCanSpecifyWasmArgs()
}
}

[Fact]
public void UserCanSpecifyWasmArgsUsingEquals()
{
var parsedConfiguration = ConfigParser.Parse(new[] { "--runtimes", "wasm", "--wasmArgs=--expose_wasm --module" }, new OutputLogger(Output));
Assert.True(parsedConfiguration.isSuccess);
var jobs = parsedConfiguration.config.GetJobs();
foreach (var job in parsedConfiguration.config.GetJobs())
{
var wasmRuntime = Assert.IsType<WasmRuntime>(job.Environment.Runtime);
Assert.Equal("--expose_wasm --module", wasmRuntime.JavaScriptEngineArguments);
}
}

[Fact]
public void UserCanSpecifyWasmArgsViaResponseFile()
{
Expand All @@ -615,6 +628,8 @@ public void UserCanSpecifyWasmArgsViaResponseFile()
foreach (var job in parsedConfiguration.config.GetJobs())
{
var wasmRuntime = Assert.IsType<WasmRuntime>(job.Environment.Runtime);
// We may need change assertion to just "--expose_wasm --module"
// if https://github.com/commandlineparser/commandline/pull/892 lands
Assert.Equal(" --expose_wasm --module", wasmRuntime.JavaScriptEngineArguments);
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/BenchmarkDotNet.Tests/TypeFilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@ public void ClassAndMethodsCanCombined()
Assert.Contains("ClassA.Method2", benchmarks);
}

[Fact]
public void MethodCanBeFilteredByParameters()
{
var benchmarks = Filter(
new[] { typeof(ClassA), typeof(ClassB), typeof(ClassE), typeof(NOTTests.ClassD) },
new[] { "--filter", "BenchmarkDotNet.Tests.ClassE.Method1(value: 0)" });

Assert.Single(benchmarks);
Assert.Contains("ClassE.Method1", benchmarks);
}

[Fact]
public void GenericTypesCanBeFilteredByDisplayName()
{
Expand Down Expand Up @@ -266,6 +277,21 @@ public class SomeGeneric<T>
[Benchmark]
public T Create() => Activator.CreateInstance<T>();
}

[Run]
public class ClassE
{
public static IEnumerable<object> Values => new object[]
{
uint.MinValue,
(uint)12345, // same value used by other tests to compare the perf
uint.MaxValue,
};

[Benchmark]
[ArgumentsSource(nameof(Values))]
public string Method1(uint value) => value.ToString();
}
}

namespace BenchmarkDotNet.NOTTests
Expand Down