File: kw_test.sh

package info (click to toggle)
kworkflow 1%3A0.6.2-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,148 kB
  • sloc: sh: 22,233; perl: 2,172; ansic: 96; python: 72; sql: 28; makefile: 19
file content (33 lines) | stat: -rwxr-xr-x 831 bytes parent folder | download
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
#!/bin/bash

include './tests/utils.sh'
unset -v KW_LIB_DIR # to be able to test the developer mode
include './kw' > /dev/null
# when imported kw prints the help function and we don“t want
# to polute our test results, so we redirect its output to /dev/null

function test_validate_global_variables()
{
  VARS=(KWORKFLOW KW_LIB_DIR)
  for v in "${VARS[@]}"; do
    test -z ${!v+x}
    assertEquals "Variable $v should exist." $? 1
  done
}

function test_check_kworkflow_global_variable()
{
  VARS=(KWORKFLOW)
  for v in "${VARS[@]}"; do
    [[ $(declare -p "$v") =~ ^declare\ -[aAilrtu]*x[aAilrtu]*\  ]] ||
      fail "Variable $v should have been exported"
  done
}

function test_set_KW_LIB_DIR_in_dev_mode()
{
  lib="${KW_LIB_DIR}/kwlib.sh"
  test -f "${lib}" || fail "kwlib.sh not found (${lib} not found)!"
}

invoke_shunit