@@ -130,11 +130,12 @@ private string GenerateScriptFromLoggingStatements(params string[] logStatements
130
130
}
131
131
132
132
// Have script create file first with `>` (but don't rely on overwriting).
133
- StringBuilder builder = new StringBuilder ( ) . Append ( '\' ' ) . Append ( logStatements [ 0 ] ) . Append ( "' > '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
133
+ // NOTE: We don't quote the log statements so that we can use PowerShell variables.
134
+ StringBuilder builder = new StringBuilder ( ) . Append ( logStatements [ 0 ] ) . Append ( " > '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
134
135
for ( int i = 1 ; i < logStatements . Length ; i ++ )
135
136
{
136
137
// Then append to that script with `>>`.
137
- builder . Append ( ' \' ' ) . Append ( logStatements [ i ] ) . Append ( "' >> '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
138
+ builder . Append ( logStatements [ i ] ) . Append ( " >> '" ) . Append ( s_testOutputPath ) . AppendLine ( "'" ) ;
138
139
}
139
140
140
141
_output . WriteLine ( "Script is:" ) ;
@@ -164,6 +165,17 @@ public void CanInitializeWithCorrectServerSettings()
164
165
Assert . True ( PsesDebugAdapterClient . ServerSettings . SupportsSetVariable ) ;
165
166
}
166
167
168
+ [ Fact ]
169
+ public async Task UsesDotSourceOperatorAndQuotes ( )
170
+ {
171
+ string filePath = NewTestFile ( GenerateScriptFromLoggingStatements ( "$MyInvocation.Line" ) ) ;
172
+ await PsesDebugAdapterClient . LaunchScript ( filePath , Started ) . ConfigureAwait ( true ) ;
173
+ ConfigurationDoneResponse configDoneResponse = await PsesDebugAdapterClient . RequestConfigurationDone ( new ConfigurationDoneArguments ( ) ) . ConfigureAwait ( true ) ;
174
+ Assert . NotNull ( configDoneResponse ) ;
175
+ Assert . Collection ( await GetLog ( ) . ConfigureAwait ( true ) ,
176
+ ( i ) => Assert . StartsWith ( ". \" " , i ) ) ;
177
+ }
178
+
167
179
[ Fact ]
168
180
public async Task CanLaunchScriptWithNoBreakpointsAsync ( )
169
181
{
0 commit comments