1+ name : PowerShell Quoting Test
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - master
8+ workflow_dispatch :
9+
10+ jobs :
11+ test-powershell-quoting :
12+ runs-on : windows-latest
13+ steps :
14+ - uses : actions/checkout@v4
15+
16+ - name : Set up Python
17+ uses : actions/setup-python@v4
18+ with :
19+ python-version : " 3.11"
20+
21+ - name : Install dependencies
22+ run : |
23+ pip install --upgrade pip
24+ pip install -e .
25+ shell : pwsh
26+
27+ - name : Test Unix-style quoting (should fail in PowerShell)
28+ id : unix-style
29+ shell : pwsh
30+ continue-on-error : true
31+ run : |
32+ # This should fail because PowerShell interprets the quotes differently
33+ isic metadata download -s 'diagnosis_3:"Squamous cell carcinoma in situ"' --limit 1
34+
35+ - name : Test incorrect PowerShell quoting (should also fail)
36+ id : incorrect-powershell
37+ shell : pwsh
38+ continue-on-error : true
39+ run : |
40+ # This is what users might try but still fails
41+ isic metadata download -s "diagnosis_3:\"Squamous cell carcinoma in situ\"" --limit 1
42+
43+ - name : Test correct PowerShell quoting with doubled quotes
44+ id : correct-powershell-doubled
45+ shell : pwsh
46+ continue-on-error : true
47+ run : |
48+ # This should work - doubled quotes inside single quotes
49+ isic metadata download -s 'diagnosis_3:""Squamous cell carcinoma in situ""' --limit 1
50+
51+ - name : Test correct PowerShell quoting with backticks
52+ id : correct-powershell-backticks
53+ shell : pwsh
54+ continue-on-error : true
55+ run : |
56+ # This should work - backtick escaping
57+ isic metadata download -s "diagnosis_3:`"Squamous cell carcinoma in situ`"" --limit 1
58+
59+ - name : Test simple query without spaces (should always work)
60+ id : simple-query
61+ shell : pwsh
62+ run : |
63+ # This should always work regardless of shell
64+ isic metadata download -s 'age_approx:50' --limit 1
65+
66+ - name : Verify test results
67+ shell : pwsh
68+ run : |
69+ Write-Host "Test Results Summary:"
70+ Write-Host "Unix-style quoting exit code: ${{ steps.unix-style.outcome }}"
71+ Write-Host "Incorrect PowerShell quoting exit code: ${{ steps.incorrect-powershell.outcome }}"
72+ Write-Host "Correct PowerShell doubled quotes exit code: ${{ steps.correct-powershell-doubled.outcome }}"
73+ Write-Host "Correct PowerShell backticks exit code: ${{ steps.correct-powershell-backticks.outcome }}"
74+ Write-Host "Simple query exit code: ${{ steps.simple-query.outcome }}"
75+
76+ # We expect the first two to fail and the last three to succeed
77+ if ("${{ steps.unix-style.outcome }}" -eq "failure" -and
78+ "${{ steps.incorrect-powershell.outcome }}" -eq "failure" -and
79+ "${{ steps.correct-powershell-doubled.outcome }}" -eq "success" -and
80+ "${{ steps.correct-powershell-backticks.outcome }}" -eq "success" -and
81+ "${{ steps.simple-query.outcome }}" -eq "success") {
82+ Write-Host "✅ PowerShell quoting behavior is as expected"
83+ exit 0
84+ } else {
85+ Write-Host "❌ Unexpected PowerShell quoting behavior"
86+ exit 1
87+ }
88+
89+ test-cmd-quoting :
90+ runs-on : windows-latest
91+ steps :
92+ - uses : actions/checkout@v4
93+
94+ - name : Set up Python
95+ uses : actions/setup-python@v4
96+ with :
97+ python-version : " 3.11"
98+
99+ - name : Install dependencies
100+ run : |
101+ pip install --upgrade pip
102+ pip install -e .
103+ shell : cmd
104+
105+ - name : Test quoting in Command Prompt
106+ shell : cmd
107+ run : |
108+ REM Test basic quoting in cmd.exe
109+ isic metadata download -s "diagnosis_3:\"Squamous cell carcinoma in situ\"" --limit 1
110+
111+ - name : Test simple query in Command Prompt
112+ shell : cmd
113+ run : |
114+ isic metadata download -s "age_approx:50" --limit 1
0 commit comments