Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Tests for BigInteger parsing across cultures (#25396)#25463

Closed
AbishekPonmudi wants to merge 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
AbishekPonmudi:patch-5AbishekPonmudi/PowerShell:patch-5Copy head branch name to clipboard
Closed

Tests for BigInteger parsing across cultures (#25396)#25463
AbishekPonmudi wants to merge 2 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
AbishekPonmudi:patch-5AbishekPonmudi/PowerShell:patch-5Copy head branch name to clipboard

Conversation

@AbishekPonmudi

@AbishekPonmudi AbishekPonmudi commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

Tests for BigInteger Parsing Across Cultures (#25396)

Overview

This PR adds unit tests for verifying BigInteger parsing across different cultures and number formats. The tests ensure PowerShell correctly converts numbers with various thousands separators, including:

  • Comma (1,000) → Used in en-US, hi-IN
  • Space (1 000) → Used in ru-RU, fr-FR, sv-SE
  • Indian number format (1,00,000) → Used in hi-IN

The tests dynamically fetch the correct NumberGroupSeparator based on the current locale to prevent parsing errors seen in older PowerShell versions.

Changes Included

  • Added test file: test/powershell/engine/BigIntegerCultureHandling.Tests.ps1
  • Uses Pester for structured validation
  • Verifies PowerShell correctly handles thousands-separated numbers
  • Ensures compatibility across multiple cultures (en-US, hi-IN, fr-FR, etc.)

Related PRs

This PR adds necessary tests for PR #25396, ensuring full validation of numeric parsing behavior.

[System.Globalization.CultureInfo]::CurrentCulture = [System.Globalization.CultureInfo]::GetCultureInfo("en-US")
$formattedNumber = "1,000"
$result = 0
$parsed = [bigint]::TryParse($formattedNumber, [System.Globalization.NumberStyles]::Number, [System.Globalization.CultureInfo]::CurrentCulture, [ref]$result)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have no need to test standard .Net methods.

@AbishekPonmudi AbishekPonmudi deleted the patch-5 branch May 2, 2025 11:27
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented May 2, 2025

Copy link
Copy Markdown
Contributor

📣 Hey @@AbishekPonmudi, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.