Commit graph

14 commits

Author SHA1 Message Date
xtqqczze 379cbb60cd Correctly capitalize the ForEach operator in *.ps1 (#8583) 2019-01-06 17:00:56 +05:00
Dan Thompson ce3cb68551 Make Select-Object/ForEach-Object/Where-Object see dynamic properties (#6898)
Dynamic (DLR) objects work in some places today, but not others.  This change expands that support to ForEach-Object, Where-Object and the family of cmdlets that use 'MshExpression' (Select-Object, etc.).

This change addresses both wildcard and non-wildcard cases. In wildcard cases, it uses the existing support of generating PSDynamicMember objects for names returned by GetDynamicMemberNames.

In non-wildcard cases, a dynamic property access is attempted whether or not the name shows up in GetDynamicMemberNames, but a truly "blind" access is only attempted if we see that the base object is an IDMOP. If the dynamic access fails, you'll get the same or a similar error experience as before ("The property 'Blarg' cannot be found", or no error at all, depending on the cmdlet and the strict mode setting).

The included test coverage includes a stub for the.ForEach operator--once people are happy with this change, I can continue by adding support there.

This change should allegedly also have positive perf impact, though in actual perf testing, although it does seem ever-so-slightly faster, I found it difficult to measure much difference at all.
2018-06-12 23:48:34 -07:00
Dongbo Wang 294def7b11
Fix 'PropertyOnlyAdapter' to allow calling base methods (#6394)
For a PropertyOnlyAdapter, the property may come from various sources, but methods, including parameterized properties, still come from DotNetAdapter. So, the binder can optimize on method calls for objects that map to a custom PropertyOnlyAdapter.
2018-03-15 15:09:38 -07:00
Klaudia Algiz 090f8761e8 Use new Pester syntax: -Parameter for Pester tests in engine. (#6298)
* Use new Pester syntax: -Parameter for Pester tests in engine.
2018-03-14 12:13:32 -07:00
Steve Lee c1c5344a88 Update copyright and license headers (#6134)
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files.

Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks.

Separate PR coming to update contribution document for new source files: #6140

Manually reviewed each change.

Fix #6073
2018-02-13 09:23:53 -08:00
Ilya 6825182a6a
Add ForEach and Where methods to [PSCustomobject] (#5756) 2018-01-05 22:54:31 +04:00
Ilya 7257404929
Add Count and Length properties to [PSCustomobject] (#5745)
Related #3671
•Add Count and Length properties to [PSCustomobject].
 Now following returns 1:
 ([pscustomobject] @{ foo = 'bar' }).Count
 ([pscustomobject] @{ foo = 'bar' }).Length
•Add tests
2017-12-28 10:15:06 +04:00
Steve Lee 2639cd89ce Autocorrected CRLF to LF (#4943)
Also, fix `Parser.Tests.ps1` after correcting CRLF.
2017-09-29 16:28:15 -07:00
Staffan Gustafsson 916ef56eeb Call to CodeMethod returning void should work (#4850)
Fixes #4826
2017-09-20 14:37:43 -07:00
Dongbo Wang 069c7a4b6f Enable DataRow/DataRowView adapters in PowerShell Core (#4258) 2017-07-17 11:27:01 -07:00
Jason Shirk 02b5f357a2 Remove trailing whitespace (#3001) 2017-01-16 13:31:14 -08:00
iSazonov 8abb6c3a94 Implicitly convert value assigned to XML property to string (#2678)
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.
2016-12-02 15:43:10 -08:00
James Truher [MSFT] 3f99de5784 Added tests to close code coverage in CIM area (#2528)
* Added tests to close code coverage in CIM area

Added CimAdapter.Tests for adaptation layer (code cribbed from BVT tests)
Added SessionOption.Tests.ps1 (Code cribbed from BVT tests)
Modified CimClass tests by adding more tests
Added CimSession.Tests for basic tests of New-CimSession cmdlet
Added CimInstance.Tests for basic tests of Get-CimInstance

* Add CI tags to tests

* unify test execution to use try/catch for marking tests as skipped

moved test which retrieves cimclass via method to feature as it is not
a common operation, this test can take some time as well
2016-11-17 11:46:07 -08:00
James Truher a8aeb55edb Move tests to more appropriate places now that we have the directory structure defined 2016-09-28 14:57:50 -07:00