~dricottone/my-utils

ref: 596d0a2530fc8b5bedf46eb7d9282766a2046ac2 my-utils/core/test/rmold.bats -rw-r--r-- 1.1 KiB
596d0a25Dominic Ricottone Help and usage messages 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bats
bats_require_minimum_version 1.5.0

@test "rmold version" {
  run --separate-stderr rmold --version
  [ "$status" -eq 0 ]
  [ "$output" = "rmold 1.0" ]
  [ "$stderr" = "" ]
}

@test "rmold version short" {
  run --separate-stderr rmold -v
  [ "$status" -eq 0 ]
  [ "$output" = "rmold 1.0" ]
  [ "$stderr" = "" ]
}

@test "rmold help" {
  run --separate-stderr rmold --help
  [ "$status" -eq 0 ]
  [ "${lines[0]}" = "Delete files older than a year" ]
  [ "${lines[1]}" = "Usage: rmold [PATH]" ]
  [ "${lines[2]}" = "Options:" ]
  [ "${lines[3]}" = " -h, --help     print this message and exit" ]
  [ "${lines[4]}" = " -v, --version  print version number and exit" ]
  [ "$stderr" = "" ]
}

@test "rmold help short" {
  run --separate-stderr rmold -h
  [ "$status" -eq 0 ]
  [ "${lines[0]}" = "Delete files older than a year" ]
  [ "${lines[1]}" = "Usage: rmold [PATH]" ]
  [ "${lines[2]}" = "Options:" ]
  [ "${lines[3]}" = " -h, --help     print this message and exit" ]
  [ "${lines[4]}" = " -v, --version  print version number and exit" ]
  [ "$stderr" = "" ]
}