21 lines
762 B
TypeScript
21 lines
762 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { parseCommandLine } from '../src/commandLine.ts'
|
|
|
|
test('quoted arguments retain their spaces',()=>{
|
|
assert.deepEqual(parseCommandLine('pytest "tests/my feature.py" -k \'works here\''),['pytest','tests/my feature.py','-k','works here'])
|
|
})
|
|
|
|
test('escaped spaces and empty quoted arguments are retained',()=>{
|
|
assert.deepEqual(parseCommandLine('tool one\\ two ""'),['tool','one two',''])
|
|
})
|
|
|
|
test('windows paths are not damaged by parsing',()=>{
|
|
assert.deepEqual(parseCommandLine('py "C:\\Mes Tests\\test.py"'),['py','C:\\Mes Tests\\test.py'])
|
|
})
|
|
|
|
test('an unclosed quote is rejected',()=>{
|
|
assert.throws(()=>parseCommandLine('pytest "tests/file.py'),/Guillemet non fermé/)
|
|
})
|