-
Notifications
You must be signed in to change notification settings - Fork 218
Add GH Action for Testing on Windows #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3358634
add windows simple-responder
mostlygeek 23ae664
update getSimpleResponderPath() for windows
mostlygeek ce78dd3
.
mostlygeek 62f5eab
fix shlex?
mostlygeek 89118f3
enable all tests
mostlygeek 4e60058
test fixes for windows
mostlygeek cb16047
.
mostlygeek 41721ef
.
mostlygeek 434044e
fix Sanitize, add cache
mostlygeek 23a3e56
.
mostlygeek d744e6e
.
mostlygeek 9f6fe6a
sigh
mostlygeek fc7a200
more test tweaks
mostlygeek 7da2565
. [no-ci]
mostlygeek 432c1e6
. [no-ci]
mostlygeek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| //go:build !windows | ||
|
|
||
| package proxy | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestConfig_SanitizeCommand(t *testing.T) { | ||
| // Test a command with spaces and newlines | ||
| args, err := SanitizeCommand(`python model1.py \ | ||
| -a "double quotes" \ | ||
| --arg2 'single quotes' | ||
| -s | ||
| --arg3 123 \ | ||
| --arg4 '"string in string"' | ||
| -c "'single quoted'" | ||
| `) | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, []string{ | ||
| "python", "model1.py", | ||
| "-a", "double quotes", | ||
| "--arg2", "single quotes", | ||
| "-s", | ||
| "--arg3", "123", | ||
| "--arg4", `"string in string"`, | ||
| "-c", `'single quoted'`, | ||
| }, args) | ||
|
|
||
| // Test an empty command | ||
| args, err = SanitizeCommand("") | ||
| assert.Error(t, err) | ||
| assert.Nil(t, args) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| //go:build windows | ||
|
|
||
| package proxy | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestConfig_SanitizeCommand(t *testing.T) { | ||
| // does not support single quoted strings like in config_posix_test.go | ||
| args, err := SanitizeCommand(`python model1.py \ | ||
| -a "double quotes" \ | ||
| -s | ||
| --arg3 123 \ | ||
| --arg4 '"string in string"' | ||
| -c "'single quoted'" | ||
| `) | ||
| assert.NoError(t, err) | ||
| assert.Equal(t, []string{ | ||
| "python", "model1.py", | ||
| "-a", "double quotes", | ||
| "-s", | ||
| "--arg3", "123", | ||
| "--arg4", "'string in string'", // this is a little weird but the lexer says so...? | ||
| "-c", `'single quoted'`, | ||
| }, args) | ||
|
|
||
| // Test an empty command | ||
| args, err = SanitizeCommand("") | ||
| assert.Error(t, err) | ||
| assert.Nil(t, args) | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Consider adding Windows-specific path tests.
Since this PR aims to improve Windows path compatibility, consider adding tests specifically for Windows path handling with backslashes, which often cause issues due to their use as escape characters.
func TestConfig_SanitizeCommand(t *testing.T) { // existing tests... + // Test Windows path handling + pathArgs, pathErr := SanitizeCommand(`python "C:\Program Files\script.py" --input "D:\Data Files\input.txt"`) + assert.NoError(t, pathErr) + assert.Equal(t, []string{ + "python", "C:\\Program Files\\script.py", + "--input", "D:\\Data Files\\input.txt", + }, pathArgs) }Let's verify how the current Windows command parsing handles backslashes in paths:
🏁 Script executed:
Length of output: 269
Add Windows-specific backslash path tests in proxy/config_windows_test.go
To ensure
SanitizeCommandcorrectly handles Windows paths (which include backslashes), add a test case inTestConfig_SanitizeCommandthat exercises typicalC:\…andD:\…paths.• File:
proxy/config_windows_test.goLocation: inside the existing
func TestConfig_SanitizeCommand(t *testing.T) { … }blockfunc TestConfig_SanitizeCommand(t *testing.T) { // existing tests… + // Windows path handling with backslashes + pathArgs, pathErr := SanitizeCommand(`python "C:\Program Files\script.py" --input "D:\Data Files\input.txt"`) + assert.NoError(t, pathErr) + assert.Equal(t, []string{ + "python", `C:\Program Files\script.py`, + "--input", `D:\Data Files\input.txt`, + }, pathArgs) }📝 Committable suggestion
🤖 Prompt for AI Agents