File: test-msg.sh

package info (click to toggle)
bashdb 4.0.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,820 kB
  • ctags: 942
  • sloc: sh: 10,581; lisp: 885; makefile: 449; ansic: 325
file content (37 lines) | stat: -rwxr-xr-x 866 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
34
35
36
37
#!/bin/bash
# -*- shell-script -*-

test_msg()
{
    local -i _Dbg_logging=0
    local -i _Dbg_logging_redirect=0
    local _Dbg_tty=''
    local msg=$(_Dbg_msg hi)
    assertEquals 'hi' "$msg"
    msg=$(_Dbg_msg_nocr hi)
    assertEquals 'hi' "$msg"
    msg=$(_Dbg_printf '%03d' 5)
    assertEquals '005' "$msg"
    msg=$(_Dbg_printf_nocr '%-3s' 'fo')
    assertEquals 'fo ' "$msg"
}

test_undefined()
{
    typeset -i _Dbg_logging=0
    typeset -i _Dbg_logging_redirect=0
    typeset _Dbg_tty=''
    typeset msg
    msg=$(_Dbg_undefined_cmd foo bar)
    assertEquals 'Undefined foo subcommand "bar". Try "help foo".' "$msg"
    msg=$(_Dbg_undefined_cmd foo)
    assertEquals 'Undefined command "foo". Try "help".' "$msg"
}

# load shunit2
top_srcdir=/src/external-vcs/bashdb
. ${top_srcdir}/lib/msg.sh
. ${top_srcdir}/dbg-io.sh

. ${top_srcdir}/test/unit/shunit2