Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test of get_list type #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YenPeiChen07
Copy link
Contributor

I added a test test_get_list_type() in tests/test_bash_utils.sh to test whether the get_list is a function.

Because I found display and get_list are the functions defined in bash_utils file, but there is just a test for display in tests/test_bash_utils.sh. Thus, I add one for get_list.

Here is the test I added:

test_get_list_type() {
  expected="get_list is a function"
  actual=$(type get_list | grep "is a")
  assertEquals "${expected}" "${actual}"
}

The tests are passed after running ./runner.sh

jenny@moria:~/devenv/tests$ ./runner.sh
*** test file: test_init_var.sh
test_devenvroot
test_devenvflavor
test_devenvflavorroot
test_devenvcurrentroot
test_devenvlibrary_path_backup
test_devenvpath_backup
test_devenvprefix
test_devenvdlroot

Ran 8 tests.

OK
*** test file: test_bash_utils.sh
test_display_type
test_display
test_display_e
devenv shunit2 unittest
test_get_list_type
test_get_cmd_list
test_get_build_list
test_get_application_list
test_get_flavor_list

Ran 8 tests.

OK
*** test file: test_devenv_impl.sh
test_namemunge
test_nameremove

Ran 2 tests.

OK

Any suggestions and comments are welcome!

@YenPeiChen07 YenPeiChen07 marked this pull request as ready for review August 26, 2021 07:31
@yungyuc yungyuc added the testing testing and ci label Aug 27, 2021
@@ -24,6 +24,12 @@ test_display_e() {
assertEquals "${expected_return_code}" "${actual_return_code}"
}

test_get_list_type() {
expected="get_list is a function"
actual=$(type get_list | grep "is a")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about testing the return of get_list instead of checking the type? bash does not have a lot of types so it is probably not very informative.

There are currently 4 kinds of lists to be returned from get_list: flavor, build, application, and cmd. "flavor" and "cmd" may be more useful than others.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YenPeiChen07 any update?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YenPeiChen07 Another month passed. Is there any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing testing and ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants