mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
.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.
30 lines
1014 B
PowerShell
30 lines
1014 B
PowerShell
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
Describe "DotNetAPI" -Tags "CI" {
|
|
|
|
It "Should be able to use static .NET classes and get a constant" {
|
|
[System.Math]::E | Should -Be 2.718281828459045
|
|
[System.Math]::PI | Should -Be 3.141592653589793
|
|
}
|
|
|
|
It "Should be able to invoke a method" {
|
|
[System.Environment]::GetEnvironmentVariable("PATH") | Should -Be $env:PATH
|
|
}
|
|
|
|
It "Should not require 'system' in front of static classes" {
|
|
[Environment]::CommandLine | Should -Be ([System.Environment]::CommandLine)
|
|
[Math]::E | Should -Be ([System.Math]::E)
|
|
}
|
|
|
|
It "Should be able to create a new instance of a .Net object" {
|
|
[System.Guid]$guidVal = [System.Guid]::NewGuid()
|
|
$guidVal | Should -BeOfType Guid
|
|
}
|
|
|
|
It "Should access types in System.Console" {
|
|
$type = "System.Console" -as [type]
|
|
$type.GetTypeInfo().FullName | Should -BeExactly "System.Console"
|
|
}
|
|
}
|