Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_gitadd.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_gitadd.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mf_deletefile.sas
7 @li mf_writefile.sas
8 @li mp_gitadd.sas
9 @li mp_gitstatus.sas
10 @li mp_assert.sas
11
12**/
13
14/* clone the source repo */
15%let dir = %sysfunc(pathname(work))/core;
16%put source clone rc=%sysfunc(GITFN_CLONE(https://github.com/sasjs/core,&dir));
17
18/* add a file */
19%mf_writefile(&dir/somefile.txt,l1=some content)
20/* change a file */
21%mf_writefile(&dir/readme.md,l1=new readme)
22/* delete a file */
23%mf_deletefile(&dir/package.json)
24
25/* Run git status */
26%mp_gitstatus(&dir,outds=work.gitstatus)
27
28%let test1=0;
29proc sql noprint;
30select count(*) into: test1 from work.gitstatus where staged='FALSE';
31
32/* should be three unstaged changes now */
33%mp_assert(
34 iftrue=(&test1=3),
35 desc=3 changes are ready to add,
36 outds=work.test_results
37)
38
39/* add them */
40%mp_gitadd(&dir,inds=work.gitstatus,mdebug=&sasjs_mdebug)
41
42/* check status */
43%mp_gitstatus(&dir,outds=work.gitstatus2)
44%let test2=0;
45proc sql noprint;
46select count(*) into: test2 from work.gitstatus2 where staged='TRUE';
47
48/* should be three staged changes now */
49%mp_assert(
50 iftrue=(&test2=3),
51 desc=3 changes were added,
52 outds=work.test_results
53)