src/test-parse-clone.sh
8f951e19
 #! /bin/sh -e
 
 . mulle-bootstrap-repositories.sh
 
 
 run_test_1()
 {
    local name
    local url
    local branch
    local scm
    local tag
    local stashdir
 
    parse_clone "url/name;stashdir;branch;scm;tag"
 
    [ "${url}"      = "url/name" ]  || fail "wrong name \"${url}\""
    [ "${name}"     = "name" ]      || fail "wrong name \"${name}\""
    [ "${stashdir}" = "stashdir" ]  || fail "wrong stashdir \"${stashdir}\""
    [ "${branch}"   = "branch" ]    || fail "wrong branch \"${branch}\""
    [ "${tag}"      = "tag" ]       || fail "wrong tag \"${tag}\""
    [ "${scm}"      = "scm" ]       || fail "wrong scm \"${scm}\""
 }
 
 run_test_2()
 {
    local name
    local url
    local branch
    local scm
    local tag
    local stashdir
 
6924181d
    parse_clone "url/name;whatever;;;"
8f951e19
 
    [ "${url}"      = "url/name" ]  || fail "wrong name \"${url}\""
    [ "${name}"     = "name" ]      || fail "wrong name \"${name}\""
6924181d
    [ "${stashdir}" = "whatever" ]  || fail "wrong stashdir \"${stashdir}\""
    [ "${branch}"   = "" ]          || fail "wrong branch \"${branch}\""
    [ "${tag}"      = "" ]          || fail "wrong tag \"${tag}\""
    [ "${scm}"      = "" ]          || fail "wrong scm \"${scm}\""
8f951e19
 }
 
 
6924181d
 ROOT_DIR="`pwd`"
8f951e19
 
 run_test_1
 run_test_2
 
 echo "test finished" >&2