refactor: optimize PR title generation and expand test coverage #549

Merged
techknowlogick merged 4 commits from appleboy/tea:bug2 into main 2023-04-29 16:16:19 +00:00
Member
  • Import "regexp" package in pull_create.go
  • Replace existing code for GetDefaultPRTitle with a more efficient regular expression approach
  • Add a new test file pull_create_test.go with a test function for GetDefaultPRTitle

See testing case:

		{input: "Add new feature", want: "Add New Feature"},
		{input: "update-docs: Fix typo", want: "Fix Typo"},
		{input: "remove_long-string", want: "Remove Long String"},
		{input: "Replace_Underscores_With_Spaces", want: "Replace Underscores With Spaces"},
		{input: "  leading-and-trailing-spaces ", want: "Leading And Trailing Spaces"},
		{input: "-----No--Upper--Case-----", want: "No Upper Case"},

Signed-off-by: appleboy appleboy.tw@gmail.com

- Import "regexp" package in pull_create.go - Replace existing code for `GetDefaultPRTitle` with a more efficient regular expression approach - Add a new test file pull_create_test.go with a test function for `GetDefaultPRTitle` See testing case: ``` {input: "Add new feature", want: "Add New Feature"}, {input: "update-docs: Fix typo", want: "Fix Typo"}, {input: "remove_long-string", want: "Remove Long String"}, {input: "Replace_Underscores_With_Spaces", want: "Replace Underscores With Spaces"}, {input: " leading-and-trailing-spaces ", want: "Leading And Trailing Spaces"}, {input: "-----No--Upper--Case-----", want: "No Upper Case"}, ``` Signed-off-by: appleboy <appleboy.tw@gmail.com>
appleboy added 1 commit 2023-04-29 00:11:22 +00:00
refactor: optimize PR title generation and expand test coverage
- Import "regexp" package in pull_create.go
- Replace existing code for `GetDefaultPRTitle` with a more efficient regular expression approach
- Add a new test file pull_create_test.go with a test function for `GetDefaultPRTitle`

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 1m44s
6da66a0318
appleboy requested review from lunny 2023-04-29 00:11:30 +00:00
appleboy requested review from wolfogre 2023-04-29 00:11:36 +00:00
appleboy added 1 commit 2023-04-29 00:24:36 +00:00
refactor: improve API usage and test robustness
- Extract the part after the last colon in the input string for `GetDefaultPRTitle` function

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Some checks failed
check-and-test / check-and-test (pull_request) Failing after 25s
a554c30e6c
appleboy added 1 commit 2023-04-29 00:28:51 +00:00
test: improve test coverage and API efficiency
- Add a new test file for pull_create in the task module

Signed-off-by: appleboy <appleboy.tw@gmail.com>
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 35s
e250be5d40
appleboy added 1 commit 2023-04-29 01:41:22 +00:00
Merge branch 'main' into bug2
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 30s
c89f4f8553
lunny approved these changes 2023-04-29 01:54:38 +00:00
techknowlogick approved these changes 2023-04-29 16:15:55 +00:00
techknowlogick merged commit 4915862b95 into main 2023-04-29 16:16:19 +00:00
Sign in to join this conversation.
No description provided.