#!/bin/bash # -*- shell-script -*- setglobal this_script = 'test-get-sourceline.sh' setglobal abs_top_srcdir = '/src/external-vcs/sourceforge/bashdb' # Make sure $abs_top_srcdir has a trailing slash setglobal abs_top_srcdir = "$(abs_top_srcdir%%/)/" # Test _Dbg_get_source_line proc test_get_source_line { _Dbg_get_source_line 2 $this_script assertEquals '# -*- shell-script -*-' $_Dbg_source_line } # Test check_line # test should appear after tests which read in source. proc test_get_source_line_with_spaces { setglobal _Dbg_frame_last_filename = ""$(abs_top_srcdir)test/example/dir with spaces/bug.sh"" # Can't figure out how to get this packaged with autoconf, so this # will work with git only. _Dbg_frame_file if [[ -f $_Dbg_frame_filename ]] && [[ $_Dbg_frame_filename =~ 'frame.sh' ]] { _Dbg_get_source_line 2 assertEquals 'x=1' $_Dbg_source_line } else { startSkipping echo "Skipping test due to autoconf problems" assertEquals 'skipped' 'skipped' endSkipping } } if test '/src/external-vcs/sourceforge/bashdb' = '' { echo "Something is wrong abs_top_srcdir is not set." exit 1 } source ${abs_top_srcdir}test/unit/helper.sh source ${abs_top_srcdir}init/pre.sh source ${abs_top_srcdir}lib/filecache.sh source ${abs_top_srcdir}lib/file.sh source ${abs_top_srcdir}lib/frame.sh source ${abs_top_srcdir}lib/msg.sh setglobal _Dbg_set_highlight = '''' set -- # reset $# so shunit2 doesn't get confused. [[ $0 == ${BASH_SOURCE} ]] && source ${shunit_file}