Skip to content

Commit 6f5311c

Browse files
Add 19 new miscellaneous tests across multiple categories
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
1 parent 06bf7fe commit 6f5311c

19 files changed

Lines changed: 330 additions & 0 deletions
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Test case sensitivity in process names
2+
# Windows process names are case-insensitive
3+
4+
Write-Host "Testing case sensitivity in process names..." -ForegroundColor Yellow
5+
6+
# Test with different cases
7+
& win-witr explorer.exe | Out-Null
8+
if ($LASTEXITCODE -ne 0) {
9+
Write-Error "Failed: explorer.exe"
10+
exit 1
11+
}
12+
13+
& win-witr EXPLORER.EXE | Out-Null
14+
if ($LASTEXITCODE -ne 0) {
15+
Write-Error "Failed: EXPLORER.EXE"
16+
exit 1
17+
}
18+
19+
& win-witr Explorer.exe | Out-Null
20+
if ($LASTEXITCODE -ne 0) {
21+
Write-Error "Failed: Explorer.exe"
22+
exit 1
23+
}
24+
25+
& win-witr ExPlOrEr.ExE | Out-Null
26+
if ($LASTEXITCODE -ne 0) {
27+
Write-Error "Failed: ExPlOrEr.ExE"
28+
exit 1
29+
}
30+
31+
Write-Host "Case sensitivity test passed" -ForegroundColor Green
32+
exit 0
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
REM Test multiple processes in sequence
2+
REM Verifies the tool can handle sequential lookups
3+
4+
win-witr explorer.exe
5+
win-witr svchost.exe
6+
win-witr csrss.exe
7+
win-witr lsass.exe
8+
win-witr winlogon.exe
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Test short option aliases
2+
# Verify that short options work the same as long options
3+
4+
Write-Host "Testing short option aliases..." -ForegroundColor Yellow
5+
6+
# Test -h vs --help
7+
$helpShort = & win-witr -h 2>&1 | Out-String
8+
$helpLong = & win-witr --help 2>&1 | Out-String
9+
10+
if ($helpShort -ne $helpLong) {
11+
Write-Warning "Short and long help options produce different output"
12+
}
13+
14+
# Test -v vs --version
15+
$versionShort = & win-witr -v 2>&1 | Out-String
16+
$versionLong = & win-witr --version 2>&1 | Out-String
17+
18+
if ($versionShort -ne $versionLong) {
19+
Write-Warning "Short and long version options produce different output"
20+
}
21+
22+
Write-Host "Short option aliases test completed" -ForegroundColor Green
23+
exit 0

tests/edge_cases/special_pids.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
REM Test with special PID values
2+
3+
REM PID 0 - System Idle Process
4+
win-witr --pid 0
5+
6+
REM PID 4 - System process
7+
win-witr --pid 4
8+
9+
REM PID 1 (usually doesn't exist on Windows)
10+
win-witr --pid 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
REM Test edge cases with process names
2+
3+
REM Process name with space (should handle gracefully)
4+
win-witr "Windows Defender.exe"
5+
6+
REM Process name without .exe extension (should still work based on repo memory)
7+
win-witr explorer
8+
9+
REM System process (PID 0 or 4)
10+
win-witr System
11+
12+
REM Idle process
13+
win-witr Idle
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Output validation test for --help
2+
# Verifies that help output contains expected sections
3+
4+
Write-Host "Testing help output format..." -ForegroundColor Yellow
5+
6+
$output = & win-witr --help 2>&1 | Out-String
7+
8+
# Check if output contains expected help sections
9+
$hasUsage = $output -match "usage|Usage|USAGE"
10+
$hasOptions = $output -match "options|Options|help|--help|-h"
11+
12+
if (-not $hasUsage -and -not $hasOptions) {
13+
Write-Error "Help output doesn't contain expected sections"
14+
exit 1
15+
}
16+
17+
Write-Host "Help output format is valid" -ForegroundColor Green
18+
exit 0
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Output validation test for --version
2+
# Verifies that version output contains expected information
3+
4+
Write-Host "Testing version output format..." -ForegroundColor Yellow
5+
6+
$output = & win-witr --version 2>&1 | Out-String
7+
8+
# Check if output contains version-related keywords
9+
$hasVersion = $output -match "version|v\d+\.\d+|win-witr"
10+
11+
if (-not $hasVersion) {
12+
Write-Error "Version output doesn't contain expected information"
13+
exit 1
14+
}
15+
16+
Write-Host "Version output format is valid" -ForegroundColor Green
17+
exit 0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
REM Test with unknown/invalid command-line options
2+
3+
REM Unknown long option
4+
win-witr --unknown-option
5+
6+
REM Unknown short option
7+
win-witr -x
8+
9+
REM Invalid combination
10+
win-witr --pid --port
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
REM Test error handling with invalid PID arguments
2+
REM These should handle gracefully and not crash
3+
4+
REM Invalid PID (negative number)
5+
win-witr --pid -1
6+
7+
REM Invalid PID (not a number)
8+
win-witr --pid notanumber
9+
10+
REM Invalid PID (too large)
11+
win-witr --pid 999999999
12+
13+
REM Missing PID argument
14+
win-witr --pid
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
REM Test error handling with invalid port arguments
2+
3+
REM Invalid port (negative number)
4+
win-witr --port -1
5+
6+
REM Invalid port (not a number)
7+
win-witr --port notanumber
8+
9+
REM Invalid port (too large, max is 65535)
10+
win-witr --port 999999
11+
12+
REM Missing port argument
13+
win-witr --port

0 commit comments

Comments
 (0)