Fix quoted Bash tool titles
This commit is contained in:
1 parent
4c15150338
commit
f9c8f640ce
3 files changed
+67
-52
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package com.example.aiapp
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNull
|
||||
|
||||
class ToolInputTest {
|
||||
@Test
|
||||
fun `bash wrapper ignores double quotes inside its outer pair`() {
|
||||
assertEquals(
|
||||
"rg -n \"needle\" server app",
|
||||
renderedBashScript("/usr/bin/bash -lc \"rg -n \"needle\" server app\""),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `bash wrapper ignores single quotes inside its outer pair`() {
|
||||
assertEquals(
|
||||
"printf 'hello'",
|
||||
renderedBashScript("/bin/bash -lc 'printf 'hello''"),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `unquoted or unfamiliar commands stay intact`() {
|
||||
assertNull(renderedBashScript("/usr/bin/bash -lc echo hello"))
|
||||
assertNull(renderedBashScript("/usr/bin/fish -lc 'echo hello'"))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user