From e16f1ba84f84213a8e4af4c7c4c310b8034a8ed3 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Sat, 1 Oct 2022 20:51:44 +0900 Subject: [PATCH] test: add integration test for `Quote` --- .../tests/custom_commands/form_prompts.go | 10 +++++----- .../expected/repo/.git_keep/commit-template.txt | 0 .../form_prompts/expected/repo/.git_keep/config | 4 ++++ .../expected/repo/.git_keep/info/exclude | 6 ------ .../expected/repo/.git_keep/logs/HEAD | 2 +- .../repo/.git_keep/logs/refs/heads/master | 2 +- .../46/87e94a43ed02b2ba08f3e6160ee22b92e64413 | 3 +++ .../6c/d61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 | Bin 116 -> 0 bytes .../expected/repo/.git_keep/refs/heads/master | 2 +- .../form_prompts/expected/repo/my file | 1 + .../form_prompts/expected/repo/myfile | 1 - 11 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/commit-template.txt create mode 100644 test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/46/87e94a43ed02b2ba08f3e6160ee22b92e64413 delete mode 100644 test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/6c/d61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 create mode 100644 test/integration_new/custom_commands/form_prompts/expected/repo/my file delete mode 100644 test/integration_new/custom_commands/form_prompts/expected/repo/myfile diff --git a/pkg/integration/tests/custom_commands/form_prompts.go b/pkg/integration/tests/custom_commands/form_prompts.go index e4712dbcc..4148c767a 100644 --- a/pkg/integration/tests/custom_commands/form_prompts.go +++ b/pkg/integration/tests/custom_commands/form_prompts.go @@ -17,7 +17,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ { Key: "a", Context: "files", - Command: `echo "{{.Form.FileContent}}" > {{.Form.FileName}}`, + Command: `echo {{.Form.FileContent | Quote}} > {{.Form.FileName | Quote}}`, Prompts: []config.CustomCommandPrompt{ { Key: "FileName", @@ -37,7 +37,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ { Name: "bar", Description: "Bar", - Value: "BAR", + Value: `"BAR"`, }, { Name: "baz", @@ -67,7 +67,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ assert.InPrompt() assert.MatchCurrentViewTitle(Equals("Enter a file name")) - input.Type("myfile") + input.Type("my file") input.Confirm() assert.InMenu() @@ -82,7 +82,7 @@ var FormPrompts = NewIntegrationTest(NewIntegrationTestArgs{ input.Confirm() assert.WorkingTreeFileCount(1) - assert.MatchSelectedLine(Contains("myfile")) - assert.MatchMainViewContent(Contains("BAR")) + assert.MatchSelectedLine(Contains("my file")) + assert.MatchMainViewContent(Contains(`"BAR"`)) }, }) diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/commit-template.txt b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/commit-template.txt new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/config b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/config index 596ebaeb3..8a748ce32 100644 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/config +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/config @@ -3,6 +3,10 @@ filemode = true bare = false logallrefupdates = true + ignorecase = true + precomposeunicode = true [user] email = CI@example.com name = CI +[commit] + gpgSign = false diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/info/exclude b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/info/exclude index a5196d1be..e69de29bb 100644 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/info/exclude +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/info/exclude @@ -1,6 +0,0 @@ -# git ls-files --others --exclude-from=.git/info/exclude -# Lines that start with '#' are comments. -# For a project mostly in C, the following would be a good set of -# exclude patterns (uncomment them if you want to use them): -# *.[oa] -# *~ diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/HEAD b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/HEAD index 153f2ddc4..e0854d95a 100644 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/HEAD +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/HEAD @@ -1 +1 @@ -0000000000000000000000000000000000000000 6cd61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 CI 1660591942 +0000 commit (initial): blah +0000000000000000000000000000000000000000 4687e94a43ed02b2ba08f3e6160ee22b92e64413 CI 1664625021 +0900 commit (initial): blah diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/refs/heads/master index 153f2ddc4..e0854d95a 100644 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/refs/heads/master +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/logs/refs/heads/master @@ -1 +1 @@ -0000000000000000000000000000000000000000 6cd61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 CI 1660591942 +0000 commit (initial): blah +0000000000000000000000000000000000000000 4687e94a43ed02b2ba08f3e6160ee22b92e64413 CI 1664625021 +0900 commit (initial): blah diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/46/87e94a43ed02b2ba08f3e6160ee22b92e64413 b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/46/87e94a43ed02b2ba08f3e6160ee22b92e64413 new file mode 100644 index 000000000..00eeb9d5f --- /dev/null +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/46/87e94a43ed02b2ba08f3e6160ee22b92e64413 @@ -0,0 +1,3 @@ +x1 +0 @>BUYPB Sa9 +)ĸz]?~i;x~aRX׸HW5oi4ۣ:a ]t;N+ \ No newline at end of file diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/6c/d61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/objects/6c/d61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 deleted file mode 100644 index 8d0c394f8aa5c739df95a23ba1821118395c1378..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 116 zcmV-)0E_>40ga783c@fD06pgwdlzIAH%k_z2tD-~*>p>VhDeFv^UV{S<1jF#)%xn- z>3->_8IYzB*TNKvvZ-Wbv`D(8l_jLKsTm29%b&it6XpdT^YXNBuJ6NcrPT>MGe+@3 W0j@Z3!;VR}KXa!?-rWzaL@TsV7dVap diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/refs/heads/master b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/refs/heads/master index 4c2ab0871..97a2c1d6c 100644 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/refs/heads/master +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/.git_keep/refs/heads/master @@ -1 +1 @@ -6cd61dc75eb17cf3e01d4d5f8f2b38a73ed9be90 +4687e94a43ed02b2ba08f3e6160ee22b92e64413 diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/my file b/test/integration_new/custom_commands/form_prompts/expected/repo/my file new file mode 100644 index 000000000..d6efee909 --- /dev/null +++ b/test/integration_new/custom_commands/form_prompts/expected/repo/my file @@ -0,0 +1 @@ +"BAR" diff --git a/test/integration_new/custom_commands/form_prompts/expected/repo/myfile b/test/integration_new/custom_commands/form_prompts/expected/repo/myfile deleted file mode 100644 index ba578e48b..000000000 --- a/test/integration_new/custom_commands/form_prompts/expected/repo/myfile +++ /dev/null @@ -1 +0,0 @@ -BAR