|
| 1 | +setup() { |
| 2 | + load 'tests_helper' |
| 3 | + _tests_helper |
| 4 | +} |
| 5 | + |
| 6 | + |
| 7 | +@test "0: Pre: Create file and dir" { |
| 8 | + run mkdir testing |
| 9 | + run touch testing/example |
| 10 | + assert_success |
| 11 | +} |
| 12 | + |
| 13 | +#bats test_tags=github:true |
| 14 | +@test "1: Testing file existence" { |
| 15 | + run ls testing/example |
| 16 | + assert_success |
| 17 | + [ -f "testing/example" ] |
| 18 | + assert_success |
| 19 | +} |
| 20 | + |
| 21 | +#bats test_tags=github:true |
| 22 | +@test "2: Testing file permissions" { |
| 23 | + run stat -f%p testing/example |
| 24 | + assert_success |
| 25 | + assert_output 100644 |
| 26 | + assert_file_permission 644 testing/example |
| 27 | + assert_success |
| 28 | +} |
| 29 | + |
| 30 | +#bats test_tags=github:true |
| 31 | +@test "3: Testing file content" { |
| 32 | + run cat testing/example |
| 33 | + assert_success |
| 34 | + refute_output "Expected content" |
| 35 | + assert_file_empty testing/example |
| 36 | + assert_success |
| 37 | +} |
| 38 | + |
| 39 | +#bats test_tags=github:true |
| 40 | +@test "4: Testing directory creation" { |
| 41 | + run mkdir testing/newdir |
| 42 | + [ -d "testing/newdir" ] |
| 43 | + assert_success |
| 44 | +} |
| 45 | + |
| 46 | +#bats test_tags=github:true |
| 47 | +@test "5: Testing file creation inside directory" { |
| 48 | + run touch testing/newdir/newfile |
| 49 | + [ -f "testing/newdir/newfile" ] |
| 50 | + assert_success |
| 51 | +} |
| 52 | + |
| 53 | +#bats test_tags=github:true |
| 54 | +@test "6: Testing file deletion" { |
| 55 | + run rm testing/newdir/newfile |
| 56 | + [ ! -f "testing/newdir/newfile" ] |
| 57 | + assert_success |
| 58 | +} |
| 59 | + |
| 60 | +#bats test_tags=github:true |
| 61 | +@test "7: Testing directory deletion" { |
| 62 | + run rmdir testing/newdir |
| 63 | + [ ! -d "testing/newdir" ] |
| 64 | + assert_success |
| 65 | +} |
| 66 | + |
| 67 | +#bats test_tags=github:true |
| 68 | +@test "8: Testing file deletion" { |
| 69 | + run rm testing/example |
| 70 | + [ ! -f "testing/example" ] |
| 71 | + assert_success |
| 72 | +} |
0 commit comments