test_common_utils.sh 1.14 KB
Newer Older
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
# Test common_utils

[ "$(abspath foo)" == "$PWD/foo" ] || ingest "abspath foo"
[ "$(abspath foo/bar)" == "$PWD/foo/bar" ] || ingest "abspath foo/bar"
[ "$(abspath /foo)" == "/foo" ] || ingest "abspath /foo"
[ "$(relpath $PWD/foo)" == "foo" ] || ingest "relpath foo"
[ "$(relpath foo/bar foo)" == "bar" ] || ingest "relpath foo/bar"
[ "$(realpath /foo)" == "/foo" ] || ingest "realpath /foo"

[ "$(lex_ver 2)" == "002000000" ] || ingest "lex_ver 2"
[ "$(lex_ver 2.1)" == "002001000" ] || ingest "lex_ver 2.1"
[ "$(lex_ver 2.1.4)" == "002001004" ] || ingest "lex_ver 2.1.4"
[ "$(lex_ver 2.1.4rc1)" == "002001004" ] || ingest "lex_ver 2.1.4"

[ "$(is_function abspath)" == "true" ] || ingest "is_function abspath"
[ "$(is_function foo)" == "" ] || ingest "is_function foo"
bar=baz
[ "$(is_function bar)" == "" ] || ingest "is_function bar"

rm_mkdir tmp_dir
[ -d tmp_dir ] || ingest "tmp_dir does not exist"
touch tmp_dir/afile
rm_mkdir tmp_dir
[ -e tmp_dir/afile ] && ingest "tmp_dir/afile should have been deleted"
rmdir tmp_dir
26
27
28

# On Linux docker containers in travis, can only be x86_64 or i686
[ "$(get_platform)" == x86_64 ] || [ "$(get_platform)" == i686 ] || exit 1