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 failed tests (partially): Ignore case when letters are created by libraries #22

Merged
merged 2 commits into from Dec 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 8 additions & 6 deletions bats/tests/pyrsia_cli.bats
Expand Up @@ -28,19 +28,21 @@ teardown() {
}

@test "Testing 'pyrsia help' CLI, check if the help is shown." {
# ignore case in this @test
shopt -s nocasematch
Copy link
Member

Choose a reason for hiding this comment

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

You probably want to disable this option once the test is done otherwise it might impact other tests in this file, the best way to do it is the test tear down method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I thought so too, but it does not seem to effect other tests as I run them after changing their case. That is why I added a comment line 31.
Also bats-core is doing similar without changing the settings back in their code.

FYI ⬇️ The first one passes, and the second one fails when both are in the same file.

@test "example 1" {
   shopt -s nocasematch

   run echo 'aBc'
   assert_output 'ABC'
}

@test "example 2" {
   run echo 'aBc'
   assert_output 'ABC'
}

Copy link
Member

Choose a reason for hiding this comment

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

yes, but lets play safe in this case and turn off this option when the test is done, those kind of bugs are very difficult to debug so no reason no to do it, thanks

Copy link
Contributor Author

@ihcomega56 ihcomega56 Dec 7, 2022

Choose a reason for hiding this comment

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

Okay I agree. That is safer and does not confuse other maintainers. Added it. Thank you for the good feedback.

# run pyrsia help
run "$PYRSIA_CLI" help
# check if pyrsia help is shown
assert_output --partial 'USAGE:'
assert_output --partial 'OPTIONS:'
assert_output --partial 'SUBCOMMANDS:'
assert_output --partial 'Usage:'
assert_output --partial 'Commands:'
assert_output --partial 'Options:'

# run pyrsia help
run "$PYRSIA_CLI" -h
# check if pyrsia help is shown
assert_output --partial 'USAGE:'
assert_output --partial 'OPTIONS:'
assert_output --partial 'SUBCOMMANDS:'
assert_output --partial 'Usage:'
assert_output --partial 'Commands:'
assert_output --partial 'Options:'
}

@test "Testing 'pyrsia ping' CLI, check if the node is up and reachable." {
Expand Down