From 6aa02c6911e1fd2c004f51c8687a207791e00d84 Mon Sep 17 00:00:00 2001 From: nohwnd Date: Fri, 10 Aug 2018 08:02:57 +0200 Subject: [PATCH] Remove quotes when expanding strings in test name Fix #1084 --- Functions/It.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Functions/It.ps1 b/Functions/It.ps1 index fca1624f9..db4edb911 100644 --- a/Functions/It.ps1 +++ b/Functions/It.ps1 @@ -197,7 +197,17 @@ function ItImpl $capture = $args[0].Groups[1].Value if ($testCase.Contains($capture)) { - Format-Nicely ($testCase[$capture]) + $value = $testCase[$capture] + # skip adding quotes to non-empty strings to avoid adding junk to the + # test name in case you want to expand captures like 'because' or test name + if ($value -isnot [string] -or [string]::IsNullOrEmpty($value)) + { + Format-Nicely $value + } + else + { + $value + } } else {