Interactive hosts expect an `IncompleteParseException` to signal that more input is expected.
When detecting errors, the parser can report 2 positions:
* where the error should be reported
* where the error was detected
Typically these are the same, so most error reporting methods have a single parameter.
For missing braces, the pattern is supposed to be to report the error after the opening brace, but the error is typically detected at the end of the file.
There were a few places where we were not consistent in reporting such errors, this PR corrects those places.
Native argument completers were not invoked when the argument was a single dash.
The fix is to treat unbound command parameters as command arguments for the purposes of parameter/argument completion.
* Make small optimization in parser tests
* Add Clear() for common command
Remove commands from AfterEach
* Refactoring test 'functions are resolved before cmdlets'
* Adding PowerShellHelpFiles package which contains default.help.txt to powershell-win-core
* Adding test case to validate that <pshome>/<culture>/default.help.txt is present. This is done by calling 'Get-Help'
* Updating get-help to skip searching for the help file when the InternalTestHooks.BypassOnlineHelpRetrieval is enable. This way, we force get-help to generate a metadata driven help object, which includes a helpUri that points to the fwlink defined in the cmdlet code.
* Updating get-help -online <cmdletName> tests to not delete the help files. Instead, I've added logic to get-help to not find the help file when the test hook BypassOnlineHelpRetrieval is enable.
* Corrected the opencover option to merge the output file
- Delete temporary zip file.
- Remove CodeCov uploading through cygwin.
- Add code to use Invoke-WebRequest to upload to CodeCov
* Codecov settings
- Wait for 1 build to start analysis.
- Do not wait for CI.
- Disable comments in PR.
* Addressed code review comments
* Fixing Invoke-WebRequest InFile parameter
* Adding aliases for Invoke-RestMethod and Invoke-WebRequest
* Adding test cases for Web cmdlets -InFile parameter
* Adding tests for Invoke-WebRequest (iwr) and Invoke-RestMethod (irm) using the cmdlet aliases.
* Remove the extra leading space
* Added functionality to improve failure triaging
- Nunit logs will be created to tests.
- Logs are copied to the Azure share.
- Pester is run with -Quiet
- Elevated and unelevated runs for tests with appropriate tags
* Copy logs to Azure share and upload to CodeCov
- Zip and copy to Azure log share
- Upload to codecov using cygwin
* Fixed varaible name in if condition
* Addressed code review comments
* Modified the destination folder structure for logs
- Creates a folder structure for yyyy-MM and Windows for storing logs
- Updated zip file name to not have illegal characters
* Modifications as suggested by codecov.io
* Added parameter alias to the Out-File cmdlet, allowing -FilePath to be used as -Path.
Relevant issue: https://github.com/PowerShell/PowerShell/issues/2923
* Test to confirm the alias I added to the Out-File cmdlet's -FilePath parameter works.
* Changed test for parameter alias as per feedback.
* Updating based on feedback.
Made formatting changes:
Added space between brackets and start of cmdlet.
Moved end bracket to before the pipe and Should Not Throw statement.
Removed -InputObject parameter for the test, as it was not needed.
* Added BeforeAll to the first part of the file. Replaced tabs with spaces.
#2945
* Fixing indentation within the test file
* Initial support for Fedora 24
This commit adds initial support for the Fedora distribution,
starting with Fedora 24.
Whereever possible, build tooling for CentOS has been reused.
Until the next release of PowerShell is compiled against .NET 1.1,
the Docker release image uses the CentOS 7 build, but loads
in the CentOS 7 version of `libicu50` via LD_LIBRARY_PATH.
* Update Dockerfile
Fix typos
* Stifle progress output in build.psm1 for some operations
Modify test failure presentation to use platform available XML methods
* Add timeout support for returning runtime parsing errors
Some of the language/parser tests have been hanging in a non-reproducable manner which
causes the CI system to invalidate the entire run. This change adds support for timeout
which will fail a test if it runs to long, rather than invalidate the entire run.
current behavior is still supported, and is not done in a new session:
PS> get-runtimeerror -src '1/'
At line:1 char:3
+ 1/
+ ~
You must provide a value expression following the '/' operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
Adding a timeout will do the operation in a async powershell session
PS> get-runtimeerror -src '1/' -timeout 5
You must provide a value expression following the '/' operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
If the operation takes longer than the supplied timeout, a timeout error will be returned
PS> get-runtimeerror -src 'start-sleep 6' -timeout 2
get-runtimeerror : Operation Timed Out ('start-sleep 6')
At line:1 char:1
+ get-runtimeerror -src 'start-sleep 6' -timeout 2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-RuntimeError
* Modify native linux command tests to skip on Windows and pending on Mac
* remove verbose and progress output from help tests
* Be sure that Feature Counter tests only run on Windows
Also, only call add-type in CounterTestHelperFunctions.ps1 if we're going to actually run the tests
* do not run any get-computerinfo tests on non-windows systems
* suppress progress output from PowerShell Get tests
* remove -quiet from API and CRON Builds
Travis watches output from the build to ensure that it hasn't hung
we need to find a balance between too much output and not enough output.
A run which has too much output is killed because it looks like an error loop
A run which has too little output is killed because it looks like a hang
* Remove commented line in Import-Counter.Tests.ps1
Remove extraneous extra line in PowerShellGet.Tests.ps1
* Change `-as "type"` to `-as [type]` in build.psm1
Alter timeout to 10 seconds to be improve chances of not timing out for runtime parser checks
improve logic for counter tests to also skip for IoT
* use the existing function of SkipCounterTests rather than duplicate the logic in import-counter.tests.ps1
* Initial support for Fedora 24
This commit adds initial support for the Fedora distribution,
starting with Fedora 24.
Whereever possible, build tooling for CentOS has been reused.
Until the next release of PowerShell is compiled against .NET 1.1,
the Docker release image uses the CentOS 7 build, but loads
in the CentOS 7 version of `libicu50` via LD_LIBRARY_PATH.
* Update Dockerfile
Fix typos
* Fix test where Export-Alias * fails when only single file exists
The test expects multiple files to be present at the location. We
explicitly create multiple files now under $TestDrive and use that the
location for Export-Alias
Also, so test structure changes.
* Address code review comments
* Adding PlatformNotSupportedException to *-Counter cmdlets for IoT as pdh.dll is not available.
* Adding tests to validate PlatformNotSupportedException for the Counter cmdlets on IoT.
This script downloads the latest nightly build package and executes the
tests on it. It also downloads all necessary tools and then uploads the
results to Coveralls.io. The badge for coverage is posted on README.md
* All test reported as skipped if not applicable to the platform
Fixed files:
powershell\Modules\Microsoft.PowerShell.Management\Clear-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\Get-ComputerInfo.Tests.ps1:1325:
return
powershell\Modules\Microsoft.PowerShell.Management\Get-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\New-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:7:
if ($IsWindows -eq $false) {
powershell\Modules\Microsoft.PowerShell.Management\Registry.Tests.ps1:167:
if ($IsWindows -eq $false) {
powershell\Modules\Microsoft.PowerShell.Management\Remove-EventLog.Tests.ps1:1:if
($IsWindows -and !$IsCoreCLR) {
powershell\Modules\Microsoft.PowerShell.Management\TimeZone.Tests.ps1:17:if
($IsWindows) {
powershell\Modules\Microsoft.PowerShell.Security\FileCatalog.Tests.ps1:6:if
($IsWindows) {
powershell\engine\Help\HelpSystem.Tests.ps1:112: if ($IsWindows)
* Fix test after code review
* Move skiping to common 'try'
The tokenizer did multiple scans the script line to get tokens. Before
the fix the tokenizer on the first pass examined that string as
double-quoted (Expandable) string not as here string, figured the
average double quotation mark as a closing and then starting with the
single quotation mark continued processing the line as single-quoted
string which had no closing single quotation mark.
The fix is to stop the first scan pass after getting '=' (assume
assignment-expression '$a=' for next pass).
Type completion would behave strangely when there were multiple aliases for a given type (currently only possible with type accelerators).
The fix is to only select the accelerator that matches what the user typed.
Closes#2295
* This change fixes the Invoke-RestMethod cmdlet behavior if the input is neither xml nor json.
* test description
* fixed the failed tests
* removed some duplication
* refactoring: eliminated some double castings
* added JsonObject unit tests; enhanced JSON deserialization exception message
* refactored JsonObject.Tests.ps1
* entitled test cases
* formatting
* Refactor 'FindMatchingHandler' to get rid of recursion
Search state can be saved and used throughout the searching process without the recursion.
* Rank the exception types based on how specific they are
* Refactor code to find handler based on the rank of given handlers
When a PS class is defined in a module and the module gets reloaded, the class would still use the SessionState from the old module for execution, and thus it doesn't reflect changes to the module state during the reload. This fix is to make sure we always use the current EngineSessionState for PS class execution.
* Fix OpenCover.console.exe parameter ordering issue.
The targetargs parameter needs to be at the end, otherwise everything
after that is considered as part of targetargs.
* Addressed code review comments
* Removed unnecessary file
* Rebase onto .NET Core 1.1
Modify `Build.psm1` and `project.json` files to use .NET Core 1.1.
.NET Core 1.1 ships with an older dotnet/cli than has currently been used,
so we revert to use case-sensitive directory names for dependencies.
.NET Core 1.1 is a pre-requisite for supporting Fedora 24.
* PSReadLine: Bump major version of PSReadline to 6.0.0-*
* Microsoft.PowerShell.Commands.Utility: Bump major version of Microsoft.CodeAnalysis.Csharp
* Microsoft.PowerShell.SDK: Revert attempt to import netcoreapp1.1 instead of dnxcore
* build.psm1: Restore ability to specify version of dotnet-install.sh
* Assign $ProgressPreference = "SilentlyContinue" to reduce output size
Travis is still complaining that the log file is too big, eliminating progress is
another step to reducing output. It's also not needed for our CI environment.
* Removed white space at end of lines
* fix misplacement of progress preference setting
also fix up trailing whitespace
Using LanguagePrimitives.ConvertTo (to emulate what would happen if the property were a regular .Net property typed as string), we now convert the value assigned to an XML property to string.