Skip to content

Conversation

@AbishekPonmudi
Copy link
Contributor

@AbishekPonmudi AbishekPonmudi commented Apr 27, 2025

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
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
Copy link
Contributor

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

📣 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