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

Remove skips from all tests #279

Merged
merged 3 commits into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _template/exercise_slug_test.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bats

@test "Test name - first test shouldn't be skipped" {
#skip
#[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash exercise_slug.sh
[ "$status" -eq 0 ]
[ "$output" = "What's expected" ]
}

@test "Second test onwards should be skipped" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash exercise_slug.sh
[ "$status" -eq 0 ]
[ "$output" = "What's expected" ]
Expand Down
5 changes: 1 addition & 4 deletions bin/validate_exercises
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ for exercise in *; do
# Create implementation file from example
cp example.sh ${exercise_name}.sh

# Unskip all the tests
sed -i 's/skip/# skip/g' $test_file

# Run the tests
bats $test_file
BATS_RUN_SKIPPED=true bats $test_file

cd ../
done
8 changes: 7 additions & 1 deletion config/exercise_readme.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ Run the tests with:
bats {{ .Spec.SnakeCaseName }}_test.sh
```

After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests.
After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests.

To run all tests, including the ones with `skip` annotations, run:

```bash
BATS_RUN_SKIPPED=true bats {{ .Spec.SnakeCaseName }}_test.sh
```

{{ with .Spec.Credits -}}
## Source
Expand Down
12 changes: 6 additions & 6 deletions exercises/acronym/acronym_test.sh
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
#!/usr/bin/env bash

@test 'basic' {
#skip
guygastineau marked this conversation as resolved.
Show resolved Hide resolved
#[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'Portable Network Graphics'
[ "$status" -eq 0 ]
[ "$output" == 'PNG' ]
}

@test 'lowercase words' {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'Ruby on Rails'
[ "$status" -eq 0 ]
[ "$output" == 'ROR' ]
}

@test 'punctuation' {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'First In, First Out'
[ "$status" -eq 0 ]
[ "$output" == 'FIFO' ]
}

@test 'all caps word' {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'GNU Image Manipulation Program'
[ "$status" -eq 0 ]
[ "$output" == 'GIMP' ]
}

@test 'punctuation without whitespace' {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'Complementary metal-oxide semiconductor'
[ "$status" -eq 0 ]
[ "$output" == 'CMOS' ]
}

@test 'very long abbreviation' {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash acronym.sh 'Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me'
[ "$status" -eq 0 ]
[ "$output" == 'ROTFLSHTMDCOALM' ]
Expand Down
32 changes: 16 additions & 16 deletions exercises/affine-cipher/affine_cipher_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@
# encode

@test "encode yes" {
#skip
#[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 5 7 "yes"
[ "$status" -eq 0 ]
[ "$output" == "xbt" ]
}

@test "encode no" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 15 18 "no"
[ "$status" -eq 0 ]
[ "$output" == "fu" ]
}

@test "encode OMG" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 21 3 "OMG"
[ "$status" -eq 0 ]
[ "$output" == "lvz" ]
}

@test "encode O M G" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 25 47 "O M G"
[ "$status" -eq 0 ]
[ "$output" == "hjp" ]
}

@test "encode mindblowingly" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 11 15 "mindblowingly"
[ "$status" -eq 0 ]
[ "$output" == "rzcwa gnxzc dgt" ]
}

@test "encode numbers" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 3 4 "Testing,1 2 3, testing."
[ "$status" -eq 0 ]
[ "$output" == "jqgjc rw123 jqgjc rw" ]
}

@test "encode deep thought" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 5 17 "Truth is fiction."
[ "$status" -eq 0 ]
[ "$output" == "iynia fdqfb ifje" ]
}

@test "encode all the letters" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 17 33 "The quick brown fox jumps over the lazy dog."
[ "$status" -eq 0 ]
[ "$output" == "swxtj npvyk lruol iejdc blaxk swxmh qzglf" ]
}

@test "encode with a not coprime to m" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh encode 6 17 "This is a test."
[ "$status" -eq 1 ]
[ "$output" == "a and m must be coprime." ]
Expand All @@ -68,49 +68,49 @@
# decode

@test "decode exercism" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 3 7 "tytgn fjr"
[ "$status" -eq 0 ]
[ "$output" == "exercism" ]
}

@test "decode a sentence" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 19 16 "qdwju nqcro muwhn odqun oppmd aunwd o"
[ "$status" -eq 0 ]
[ "$output" == "anobstacleisoftenasteppingstone" ]
}

@test "decode numbers" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 25 7 "odpoz ub123 odpoz ub"
[ "$status" -eq 0 ]
[ "$output" == "testing123testing" ]
}

@test "decode all the letters" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 17 33 "swxtj npvyk lruol iejdc blaxk swxmh qzglf"
[ "$status" -eq 0 ]
[ "$output" == "thequickbrownfoxjumpsoverthelazydog" ]
}

@test "decode with no spaces in input" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 17 33 "swxtjnpvyklruoliejdcblaxkswxmhqzglf"
[ "$status" -eq 0 ]
[ "$output" == "thequickbrownfoxjumpsoverthelazydog" ]
}

@test "decode with too many spaces" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 15 16 "vszzm cly yd cg qdp"
[ "$status" -eq 0 ]
[ "$output" == "jollygreengiant" ]
}

@test "decode with a not coprime to m" {
skip
[[ $BATS_RUN_SKIPPED == true ]] || skip
run bash affine_cipher.sh decode 13 5 "Test"
[ "$status" -eq 1 ]
[ "$output" == "a and m must be coprime." ]
Expand Down
7 changes: 5 additions & 2 deletions exercises/all-your-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ I think you got the idea!

*Yes. Those three numbers above are exactly the same. Congratulations!*


Run the tests with:

```bash
bats all_your_base_test.sh
```

After the first test(s) pass, continue by commenting out or removing the `skip` annotations prepending other tests.
After the first test(s) pass, continue by commenting out or removing the `[[ $BATS_RUN_SKIPPED == true ]] || skip` annotations prepending other tests.

To run all tests, including the ones with `skip` annotations, run:

```bash
BATS_RUN_SKIPPED=true bats all_your_base_test.sh
```

## External utilities
`Bash` is a language to write scripts that works closely with various system utilities,
Expand Down
Loading