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

Fix use flavor cmd #162

Merged
merged 3 commits into from
May 7, 2024
Merged

Fix use flavor cmd #162

merged 3 commits into from
May 7, 2024

Conversation

j8xixo12
Copy link
Collaborator

@j8xixo12 j8xixo12 commented May 5, 2024

In this PR I fix a use command issue which is the use command will use an unavailable flavor.
After:

$ devenv use foo ; echo $DEVENVFLAVOR
flavor foo is not available

Before:

$ devenv use foo ; echo $DEVENVFLAVOR
flavor foo is not available
now using 'foo'
foo

@j8xixo12 j8xixo12 requested review from yungyuc and chestercheng May 5, 2024 14:28
@j8xixo12 j8xixo12 self-assigned this May 5, 2024
@@ -5,5 +5,6 @@ final_ret=0
./test_init_var.sh ; if [ $? != 0 ] ; then final_ret=1 ; fi
./test_bash_utils.sh ; if [ $? != 0 ] ; then final_ret=1 ; fi
./test_devenv_impl.sh ; if [ $? != 0 ] ; then final_ret=1 ; fi
./test_init.sh ; if [ $? != 0 ] ; then final_ret=1 ; fi
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add a unit test to ensure the behavior of use command is expected.

test_use_cmd() {
devenv add foo
devenv use foo
assertNotNull ${DEVENVFLAVOR}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think using assertNotContains to check the result would be better

Copy link
Member

Choose a reason for hiding this comment

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

What should be the value of $DEVENVFLAVOR after devenv use foo? If it should be foo, perhaps this may use assertEqual or something like it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have refine the test case in 9ca221e

Copy link
Member

Choose a reason for hiding this comment

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

It's great. Thanks.

Copy link
Member

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

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

It's great to have a unit test for it!

test_use_cmd() {
devenv add foo
devenv use foo
assertNotNull ${DEVENVFLAVOR}
Copy link
Member

Choose a reason for hiding this comment

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

What should be the value of $DEVENVFLAVOR after devenv use foo? If it should be foo, perhaps this may use assertEqual or something like it?

@j8xixo12
Copy link
Collaborator Author

j8xixo12 commented May 6, 2024

@yungyuc, @chestercheng this patch is ready for review.

Copy link
Collaborator

@chestercheng chestercheng left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

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

LGTM

test_use_cmd() {
devenv add foo
devenv use foo
assertNotNull ${DEVENVFLAVOR}
Copy link
Member

Choose a reason for hiding this comment

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

It's great. Thanks.

@yungyuc yungyuc merged commit 9f45123 into solvcon:main May 7, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants