tests.af 1.18 KB
Newer Older
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
### Variable tests

defvar foo ;; This is foo
defvar bar ;; Bar this is
readvar baz ;; Give me something for baz

log Here is some foo: %foo%
log Here is some bar: %bar%
log Baz is last: %baz%
log cram them together: \%foo%\%bar%\%baz%\ - and repeat! %baz% | %foo%

### File manipulation tests.

defvar mtestfile ;; C:\Windows\Temp\_setuptest_.txt

runcmd cmd.exe ;; /c type NUL > %mtestfile% ;; 0

appendfile %mtestfile% ;; Here is some content
appendfile %mtestfile% ;; Another line
appendfile %mtestfile% ;; appending text is fun!
appendfile %mtestfile% ;; one two one two three

edfile %mtestfile% ;; append\w+ ;; editing
edfile %mtestfile% ;; (one) ;; $1$1

runcmd cmd.exe ;; /c type %mtestfile% ;; 0
runcmd cmd.exe ;; /c del %mtestfile% ;; 0

### User tests

defvar user1 ;; barfoo
defvar user2 ;; quux
readvar pass1 ;; Enter a password ;; secure
readvar pass2 ;; Enter another password ;; secure

log adding user %user1%
adduser %user1% ;; %pass1% ;; admin
adduser %user2% ;; %pass2%
adduser %user1% ;; %pass1%
runcmd net.exe ;; users
runcmd net.exe ;; localgroup Administrators
removeuser %user1%
removeuser %user2%
removeuser %user1%
runcmd net.exe ;; users
runcmd net.exe ;; localgroup Administrators