File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,8 +201,8 @@ if ($Timestamp) {
201201 $featureNum = Get-Date - Format ' yyyyMMdd-HHmmss'
202202 $branchName = " $featureNum -$branchSuffix "
203203} else {
204- # Validate -Number input when provided
205- if ($Number - lt 0 ) {
204+ # Validate -Number input when explicitly provided
205+ if ($PSBoundParameters .ContainsKey ( ' Number' ) -and $Number - lt 1 ) {
206206 Write-Error " -Number requires a positive integer, got $Number "
207207 exit 1
208208 }
Original file line number Diff line number Diff line change @@ -453,10 +453,11 @@ def test_powershell_supports_allow_existing_branch_flag(self):
453453 # Ensure the flag is referenced in script logic, not just declared
454454 assert "AllowExistingBranch" in contents .replace ("-AllowExistingBranch" , "" )
455455
456- def test_powershell_rejects_negative_number (self ):
457- """Static guard: PS script validates -Number is not negative ."""
456+ def test_powershell_rejects_invalid_number (self ):
457+ """Static guard: PS script validates -Number using PSBoundParameters and rejects < 1 ."""
458458 contents = CREATE_FEATURE_PS .read_text (encoding = "utf-8" )
459- assert "Number -lt 0" in contents or re .search (r"\$Number\s+-lt\s+0" , contents )
459+ assert "PSBoundParameters.ContainsKey" in contents
460+ assert "Number -lt 1" in contents or re .search (r"\$Number\s+-lt\s+1" , contents )
460461 assert "positive integer" in contents
461462
462463 def test_powershell_has_number_collision_validation (self ):
You can’t perform that action at this time.
0 commit comments