Macros for SAS Application Developers
https://github.com/sasjs/core
mp_gitstatus.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mp_gitstatus.sas macro
4 
5  <h4> SAS Macros </h4>
6  @li mf_deletefile.sas
7  @li mf_writefile.sas
8  @li mp_gitstatus.sas
9  @li mp_assertdsobs.sas
10 
11 **/
12 
13 /* clone the source repo */
14 %let dir = %sysfunc(pathname(work))/core;
15 %put source clone rc=%sysfunc(GITFN_CLONE(https://github.com/sasjs/core,&dir));
16 
17 %mp_gitstatus(&dir,outds=work.gitstatus)
18 
19 %mp_assert(
20  iftrue=(&syscc=0),
21  desc=Initial mp_gitstatus runs without errors,
22  outds=work.test_results
23 )
24 
25 /* should be empty as there are no changes yet */
26 %mp_assertdsobs(work.gitstatus,test=EMPTY)
27 
28 /* add a file */
29 %mf_writefile(&dir/somefile.txt,l1=some content)
30 /* change a file */
31 %mf_writefile(&dir/readme.md,l1=new readme)
32 /* delete a file */
33 %mf_deletefile(&dir/package.json)
34 
35 /* re-run git status */
36 %mp_gitstatus(&dir,outds=work.gitstatus)
37 
38 /* should be three changes now */
39 %mp_assertdsobs(work.gitstatus,test=EQUALS 3)