Commit graph

247 commits

Author SHA1 Message Date
Dongbo Wang
a4c32bc337
Revert the PRs that made DBNull.Value and NullString.Value treated as $null (#11648) 2020-01-29 14:13:05 -08:00
xtqqczze
920b671fb4 Unify pester test syntax for the arguments of -BeOfType (#11558) 2020-01-24 11:00:37 -08:00
xtqqczze
a454352f32 Fix false positives 2020-01-13 19:39:58 +00:00
xtqqczze
e0d2e2aade Correct case of $PSHOME special variable 2020-01-13 19:35:33 +00:00
xtqqczze
2782b73e37 Correct case of $PSCulture special variable 2020-01-13 19:35:06 +00:00
xtqqczze
225164037f Correct case of $PID special variable 2020-01-13 19:34:38 +00:00
xtqqczze
b5326a8488 Correct case of $Host special variable 2020-01-13 19:34:10 +00:00
xtqqczze
d0f28128f5 Correct case of $ExecutionContext special variable 2020-01-13 19:33:14 +00:00
xtqqczze
bb58e2aab6 Correct case of $false special variable 2020-01-13 19:25:35 +00:00
xtqqczze
47a3b4e293 Correct case of $true special variable 2020-01-13 19:25:09 +00:00
xtqqczze
6014f4bac3 Correct case of $null special variable 2020-01-13 19:24:42 +00:00
xtqqczze
4a9d70fdcd Correct case of $PWD special variable 2020-01-13 19:24:10 +00:00
xtqqczze
679702ba05 Correct case of $PSDefaultParameterValues special variable 2020-01-13 19:21:25 +00:00
xtqqczze
b6a687bf21 Correct case of $error special variable 2020-01-13 19:19:39 +00:00
xtqqczze
42d50434f8 Correct case of $PSCmdlet special variable 2020-01-13 19:19:12 +00:00
xtqqczze
a051666baf Correct case of $input special variable 2020-01-13 19:18:44 +00:00
xtqqczze
04b292ab3b Correct case of $LASTEXITCODE special variable 2020-01-13 19:15:45 +00:00
xtqqczze
89e33f5772 Correct case of $Matches special variable 2020-01-13 19:15:17 +00:00
xtqqczze
d58e1ff13b Correct case of $MyInvocation special variable 2020-01-13 19:04:32 +00:00
xtqqczze
4f5bb46268 Remove BOM, insert newline at EOF 2020-01-13 18:36:47 +00:00
xtqqczze
743983390e Update pester syntax to v4 (#11544)
* Capitalize 'Should' command and fix whitespace

```powershell
$_ -ireplace '\s?\|\s?should\b',' | Should'
```

* Capitalise and apply hyphen to 'Not' parameter

```powershell
$_ -ireplace '(\| Should) not\b','$1 -Not'
```

* Capitalise and apply hyphen to 'Be' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?be\b','$1 -Be'
```

* Capitalise and apply hyphen to 'BeExactly' parameter

$_ -ireplace '(\| Should(?: -Not)?) -?beexactly\b','$1 -BeExactly'

* Capitalise and apply hyphen to 'BeGreaterThan' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -?begreaterthan\b','$1 -BeGreaterThan'
```

* Use 'BeTrue' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?true\b','$1 -BeTrue'
```

* Use 'BeFalse' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?) -Be\s\$?false\b','$1 -BeFalse'
```

* Capitalise and apply hyphen to 'Match' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?match\b','$1 -Match'
```

* Capitalise and apply hyphen to 'Throw' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?throw\b','$1 -Throw'
```

* Capitalise and apply hyphen to 'BeNullOrEmpty' parameter

```powershell
$_ -ireplace '(\| Should(?: -Not)?)\s-?benullorempty\b','$1 -BeNullOrEmpty'
```

* Capitalise 'Because' parameter

```powershell
$_ -ireplace '\s-because\b',' -Because'
```

* Fix 'BeNullOrEmpty'
2020-01-11 20:41:59 +05:00
Paul Higinbotham
b19e2b9d4c Various test fixes for debugger and remoting (#11528) 2020-01-08 16:23:38 -08:00
Aditya Patwardhan
0097802cee
Normalize line endings before comparing string in tests (#11499) 2020-01-08 13:33:28 -08:00
Ilya
b221c2afa2
Correct pwsh run (#11486) 2020-01-05 12:17:41 +05:00
xtqqczze
ee71081432 Use CIM cmdlets instead of WMI cmdlets in tests (#11423) 2020-01-03 10:24:06 -08:00
Aditya Patwardhan
2dbb5717ce Make null member access tests as string to avoid parsing errors (#11385)
* Make null member access tests as string to avoid parsing errors

* Add PSNullConditionalOperators feature to testmetadata.json

* Add Parsing tests to be skipped

* Add tabcompletion tests
2019-12-21 00:14:07 +00:00
Ilya
54e6199bbb Use invariant culture string conversion for -replace operator (#10954) 2019-12-19 09:50:46 -08:00
Steve Lee
ed1f6e3144 Make approved features non-experimental (#11303) 2019-12-10 15:41:43 -08:00
Greg Smulko
f32ae64b8b Support multi-line code blocks in examples (#10776) 2019-11-15 17:24:16 -08:00
Aditya Patwardhan
2579c00a20 Support null-conditional operators ?. and ?[] in PowerShell language (#10960) 2019-11-15 16:39:53 -08:00
Robert Holt
ad12b14517 Stop blindly setting $? to true for ParenExpression, SubExpression and ArrayExpression (#11040) 2019-11-15 11:57:45 -08:00
Steve Lee
4ff9924cbf Add $env:__SuppressAnsiEscapeSequences to control whether to… (#10814) 2019-10-24 12:45:26 -07:00
Steve Lee
13f8ba284f Set the output encoding to [Console]::OutputEncoding for native commands (#10824) 2019-10-19 10:09:44 +05:00
Robert Holt
2f4ed146ae Fix pure expressions setting $? in pipeline chains (#10836) 2019-10-18 14:57:56 -07:00
Robert Holt
2a518fcfe2 Support the pipeline chain operators && and || in PowerShell language (#9849) 2019-10-17 14:43:46 -07:00
Aditya Patwardhan
425bc36a6f Implement Null Coalescing and Null Coalescing assignment operators (#10636) 2019-10-17 10:21:24 -07:00
Steve Lee
8cf9c01800 Add ConciseView for $ErrorView (#10641) 2019-10-04 16:52:57 -07:00
Kirk Munro
139cd942b2 Transition ActionPreference.Suspend enumeration value into a non-supported, reserved state, and remove restriction on using ActionPreference.Ignore in preference variables (#10317) 2019-09-07 23:45:36 +05:00
Dongbo Wang
5069c7d6a6 Support ternary operator in PowerShell language (#10367) 2019-09-04 13:22:33 -07:00
Kirk Munro
8b9f4124ce Add support to ActionPreference.Break to break into debugger (#8205) 2019-08-23 10:34:10 -07:00
Kirk Munro
c8e72d1e66 Fix minor breakpoint re-hydration bug (#10339) 2019-08-15 14:55:45 -07:00
Kirk Munro
eb81fb749a Mark -parallel and -throttlelimit reserved for foreach and switch statements (#10328) 2019-08-15 14:41:41 -07:00
Ben Gelens
ccc791c0a3 Fix #requires -version for pwsh 7 to include 6.1 and 6.2 in PSCompatibleVersions (#9943) 2019-08-12 15:25:28 -07:00
Dongbo Wang
d2e81dbc13 Special case the posix locale in WildcardPattern (#10186) 2019-07-26 10:58:37 -07:00
Joel Sallow (/u/ta11ow)
b34e331d63 Consider DBNull.Value and NullString.Value the same as $null when comparing with $null and casting to bool (#9794)
- Adds `LanguagePrimitives.IsNullLike()` method to account for `DBNull.Value` and `NullString.Value` so that they can be considered the same as a null value where sensible in PowerShell.
- Updates `-ne` and `-eq` binders to treat `DBNull.Value` and `NullString.Value` as equal to null/AutomationNull.
- Update code paths for comparing objects in LanguagePrimitives to ensure consistency with how the `-eq` and `-ne` binders work when calling LanguagePrimitives methods to do the comparisons.
- Make `LanguagePrimitives.IsNull()` and `LanguagePrimitives.IsNullLike()` public methods.
- Added tests for null behaviours in `NullRepresentatives.Tests.ps1`
2019-06-28 11:39:34 -07:00
Joel Sallow (/u/ta11ow)
86a1697da9 Allow methods to be named after keywords (#9812) 2019-06-25 11:04:00 -07:00
Joel Sallow (/u/ta11ow)
17b2cec163 Cleanup Parser tests (#9792)
Co-Authored-By: Ilya <darpa@yandex.ru>
2019-06-24 11:22:54 -07:00
Dongbo Wang
c684902fba Use the original precision (prior-dotnet-core-3) for double/fload-to-string conversion (#9893)
.NET Core changes to return "shortest roundtrippable string" by default for the ToString() method of double and float types. This results in ToString() for double/float values sometimes return a string in 17-digit/9-digit precision format. This PR updated the double/float-to-string conversion in PowerShell to continue using the old precision specifier before the change in .NET Core 3.0.
2019-06-19 08:56:43 +05:00
Kirk Munro
aac4c6ff21 Add module to support Pester tests for automating debugger commands (stepInto, stepOut, etc.), along with basic tests (#9825) 2019-06-13 07:19:13 -07:00
Joel Sallow (/u/ta11ow)
f5e3de036e Improve whitespace for Parser tests (#9806) 2019-06-05 10:09:45 +05:00