18%let root=%sysfunc(pathname(work))/top;
25libname test
"&root/a/e/f";
30%mp_assertscope(SNAPSHOT)
31%mp_dirlist(path=&root, outds=myTable, maxdepth=MAX)
32%mp_assertscope(COMPARE,
33 desc=Test 1: mp_dirlist does not leak scope,
34 outds=work.test_results
38 iftrue=(%mf_nobs(work.mytable)=6),
39 desc=All levels returned,
40 outds=work.test_results
43%mp_dirlist(path=&root, outds=myTable2, maxdepth=2)
46 iftrue=(%mf_nobs(work.mytable2)=5),
47 desc=Top two levels returned,
48 outds=work.test_results
51%mp_dirlist(path=&root, outds=work.myTable3, maxdepth=0)
54 iftrue=(%mf_nobs(work.mytable3)=2),
55 desc=Top level returned,
56 outds=work.test_results
59%mp_dirlist(path=&root/b, outds=work.myTable4)
61 iftrue=(%mf_nobs(work.mytable4)=0),
62 desc=Empty table
for empty directory,
63 outds=work.test_results
66%mp_dirlist(path=&root/notexisting, outds=work.myTable5)
68 iftrue=(%mf_nobs(work.mytable5)=0),
69 desc=Empty table
for non-existing directory,
70 outds=work.test_results
76%mp_dirlist(path=&root, outds=work.myTable6, maxdepth=MAX, maxobs=3)
78 iftrue=(%mf_nobs(work.mytable6)=3),
79 desc=Rows are capped by maxobs,
80 outds=work.test_results
83%mp_dirlist(path=&root, outds=work.myTable7, maxdepth=MAX, maxobs=100)
85 iftrue=(%mf_nobs(work.mytable7)=6),
86 desc=A maxobs above the tree size returns everything,
87 outds=work.test_results
93%mp_dirlist(path=&root, outds=work.myTable8, maxdepth=0, showparent=YES)
95 iftrue=(%mf_nobs(work.mytable8)=3),
96 desc=Showparent adds one row
for the parent,
97 outds=work.test_results
104 set work.mytable end=eof;
106 if level>maxlevel then maxlevel=level;
107 if eof then call symputx('maxlevel',maxlevel,
'l');
110 iftrue=(&maxlevel=3),
111 desc=Deepest entry is three levels below the parent,
112 outds=work.test_results
120 if filename=
'a' then call symputx('type_a',file_or_folder,
'l');
121 if filename='ds1.sas7bdat' then call symputx('type_ds1',file_or_folder,
'l');
124 iftrue=(
"%upcase(&type_a)"=
"FOLDER"),
125 desc=A directory entry is classified as a folder,
126 outds=work.test_results
129 iftrue=(
"%upcase(&type_ds1)"=
"FILE"),
130 desc=A dataset file is classified as a file,
131 outds=work.test_results
138%mp_dirlist(path=, outds=work.myTable9)
140 iftrue=(%mf_nobs(work.mytable9)>=1),
141 desc=A blank path returns the platform roots,
142 outds=work.test_results
145 set work.mytable9(obs=1);
146 call symputx('rootpath',filepath,
'l');
149 iftrue=(%length(&rootpath)>=1),
150 desc=The root entry carries a path,
151 outds=work.test_results
158 set work.test_results;
159 putlog 'TEST_RESULT_LINE: ' test_result ' - ' test_description;