File: test_hello_i18n

package info (click to toggle)
bash-unit 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 1,304 kB
  • sloc: sh: 1,134; makefile: 10
file content (18 lines) | stat: -rw-r--r-- 670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# In this example, we want to test the specific functions of a script.
# So we source this script in setup_suite.
# However, we don't want the script to be executed when sourcing it,
# we are only interested in having access to the functions to test
# them.
# To do so, we adapt the script under test so that its main code
# is not executed when sourcing it.
# See in ../hello_i18n how we define a main function to encapsulate
# all the main code and the main function is only called when the
# script itself is launched, not when it is sourced.

test_can_say_hi_in_french() {
  assert_equals "Bonjour le monde" "$(hello fr)"
}

setup_suite() {
  source ../hello_i18n
}