1# -*- mode: shell-script -*-
2
3test_dir=$(cd $(dirname $0) && pwd)
4source "$test_dir/setup.sh"
5
6oneTimeSetUp() {
7    rm -rf "$WORKON_HOME"
8    mkdir -p "$WORKON_HOME"
9    [ ! -z "$ZSH_VERSION" ] && unsetopt shwordsplit
10    source "$test_dir/../virtualenvwrapper_lazy.sh"
11    [ ! -z "$ZSH_VERSION" ] && setopt shwordsplit
12}
13
14oneTimeTearDown() {
15    rm -rf "$WORKON_HOME"
16}
17
18setUp () {
19    echo
20}
21
22function_defined_lazy() {
23    name="$1"
24    assertTrue "$name not defined" "type $name"
25	assertTrue "$name does not load virtualenvwrapper" "typeset -f $name | grep 'virtualenvwrapper_load'"
26    if [ "$name" = "mkvirtualenv" ]
27    then
28        lookfor="rmvirtualenv"
29    else
30        lookfor="mkvirtualenv"
31    fi
32	assertFalse "$name includes reference to $lookfor: $(typeset -f $name)" "typeset -f $name | grep $lookfor"
33}
34
35test_mkvirtualenv_defined_lazy() {
36    function_defined_lazy mkvirtualenv
37}
38
39test_rmvirtualenv_defined_lazy() {
40    function_defined_lazy rmvirtualenv
41}
42
43test_lsvirtualenv_defined_lazy() {
44    function_defined_lazy lsvirtualenv
45}
46
47test_showvirtualenv_defined_lazy() {
48    function_defined_lazy showvirtualenv
49}
50
51test_workon_defined_lazy() {
52    function_defined_lazy workon
53}
54
55test_add2virtualenv_defined_lazy() {
56    function_defined_lazy add2virtualenv
57}
58
59test_cdsitepackages_defined_lazy() {
60    function_defined_lazy cdsitepackages
61}
62
63test_cdvirtualenv_defined_lazy() {
64    function_defined_lazy cdvirtualenv
65}
66
67test_cdvirtualenv_defined_lazy() {
68    function_defined_lazy cdvirtualenv
69}
70
71test_lssitepackages_defined_lazy() {
72    function_defined_lazy lssitepackages
73}
74
75test_toggleglobalsitepackages_defined_lazy() {
76    function_defined_lazy toggleglobalsitepackages
77}
78
79test_cpvirtualenv_defined_lazy() {
80    function_defined_lazy cpvirtualenv
81}
82
83test_setvirtualenvproject_defined_lazy() {
84    function_defined_lazy setvirtualenvproject
85}
86
87test_mkproject_defined_lazy() {
88    function_defined_lazy mkproject
89}
90
91test_cdproject_defined_lazy() {
92    function_defined_lazy cdproject
93}
94
95test_mktmpenv_defined_lazy() {
96    function_defined_lazy mktmpenv
97}
98
99test_wipeenv_defined_lazy() {
100    function_defined_lazy wipeenv
101}
102
103test_allvirtualenv_defined_lazy() {
104    function_defined_lazy allvirtualenv
105}
106
107. "$test_dir/shunit2"
108