-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.do
54 lines (50 loc) · 1.59 KB
/
tests.do
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
do "git.ado"
local os = "`c(os)'"
local adoPlusDir = "`c(sysdir_plus)'"
if("`os'" != "Windows"){
local adoPlusDir = subinstr("`adoPlusDir'","~","/Users/`c(username)'",.)
}
local adoDir = trim(subinstr("`adoPlusDir'","ado/plus/","",.))
local gitDir = "`adoDir'git/"
local copyCmd = "cp" /* Defaults to *nix command */
local deleteCmd = "rm" /* Defaults to *nix command */
local origDir = "`c(pwd)'"
local lsCmd = "ls" /* Defaults to *nix command */
local rmdirCmd = "rm -rf" /* Defaults to *nix command */
if("`os'" == "Windows"){
local copyCmd = "copy"
local deleteCmd = "erase"
local lsCmd = "dir"
local rmdirCmd = "rmdir /Q /S"
}
/*Test installing*/
git install https://github.com/coderigo/stata-switch
local expectedRepoName = "stata-switch"
local repoSnakeCase = "switch"
capture confirm file "`gitDir'`expectedRepoName'"
if _rc!=0{
di as red "Test 1 FAILED."
di as red "Expected `gitDir'`expectedRepoName' to exist but it does not."
}
else {
di as green "Test 1 PASSED."
capture confirm file "`adoPlusDir's/`repoSnakeCase'.ado"
if _rc!=0{
di as red "Test 2 FAILED."
di "Expected `adoPlusDir's/`repoSnakeCase'.ado to exist but it does not."
}
else {
di as green "Test 2 PASSED."
}
/*Test uninstalling*/
git uninstall `repoSnakeCase'
capture confirm file "`gitDir'`expectedRepoName'"
if _rc!=0{
di as green "Test 3 PASSED."
}
else{
di as red "Test 3 FAILED."
di "Expected `gitDir'`expectedRepoName' to NOT exist but it does."
}
}
/* TODO: Add more tests */