feat/commit-split-and-pr/main #45
@@ -55,6 +55,28 @@ test('--repo 格式不是 owner/name 時失敗', async (t) => {
|
||||
assert.equal(json.error.code, 'BAD_REPO');
|
||||
});
|
||||
|
||||
test('--key=value 的值可以本身就以 -- 開頭', async (t) => {
|
||||
// commit 訊息與 PR 描述裡出現 --flag 是常態;空格分隔的寫法分不出來,等號寫法可以
|
||||
const stub = await withStub(t);
|
||||
|
||||
const { json } = await runScript('labels-list.js', ['--repo=--看起來像 flag 的值'], {
|
||||
env: envFor(stub),
|
||||
});
|
||||
|
||||
assert.equal(json.error.code, 'BAD_REPO', '要走到 repo 格式檢查,而不是被當成缺值');
|
||||
});
|
||||
|
||||
test('--key value 的值以 -- 開頭時仍然擋下,並指出等號寫法', async (t) => {
|
||||
const stub = await withStub(t);
|
||||
|
||||
const { json } = await runScript('labels-list.js', ['--repo', '--看起來像 flag 的值'], {
|
||||
env: envFor(stub),
|
||||
});
|
||||
|
||||
assert.equal(json.error.code, 'MISSING_FLAG');
|
||||
assert.match(json.error.message, /--repo=/);
|
||||
});
|
||||
|
||||
test('--key=value 與 --key value 兩種寫法等價', async (t) => {
|
||||
const stub = await withStub(t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user