diff --git a/ocaml/README.md b/ocaml/README.md index b414ee5..f547585 100644 --- a/ocaml/README.md +++ b/ocaml/README.md @@ -23,7 +23,7 @@ In this grammar, `digit` implies `decimal digit`. Spaces between the key and the ## Task list -- [ ] Spec requirements +- [x] Spec requirements - [x] Add log function - [x] Output begins with ` [log] ` - [x] Only prints if `DEBUG` is set @@ -34,7 +34,7 @@ In this grammar, `digit` implies `decimal digit`. Spaces between the key and the - [x] Properly handle a compose `su_command` such as `su -c` in `System.Package` - [x] Properly handle dependent options - [x] Implement log levels - - [ ] Write tests + - [x] Write tests - [x] Validation - [x] Valid path or in `PATH` - [x] Executability diff --git a/ocaml/test/cram.t b/ocaml/test/cram.t index 6fd618c..5090093 100644 --- a/ocaml/test/cram.t +++ b/ocaml/test/cram.t @@ -8,6 +8,17 @@ A2. 'log' MUST print only if DEBUG is set and MUST be preceded by ' [log] ' $ echo "$with_debug" | grep -Fq " [log] " $ echo "$without_debug" | grep -Fqv " [log] " +A3.2. if su_command is unset, the default must be 'su -c' + + $ echo 'simulate=true' > $HOME/.config/tori/tori.conf + $ DEBUG=1 tori pkg xterm 2>&1 | grep -Fq 'su -c' + +A3.3. if su_command is set, su_command must be the set value + + $ echo 'simulate=true' > $HOME/.config/tori/tori.conf + $ echo 'su_command=doas' >> $HOME/.config/tori/tori.conf + $ DEBUG=1 tori pkg xterm 2>&1 | grep -Fq 'doas' + A3.4. [config] su_command must be validated for presence at the provided path or a path obtained from $PATH and filesystem permission to execute @@ -40,7 +51,7 @@ B2.2. help | -h | --help -> MUST print '' B2.3. os -> MUST print the os name - $ os_name=$(cat /etc/os-release | grep '^NAME=' | cut -d = -f 2 | sed 's/"//g') + $ os_name=$(cat /etc/os-release | grep '^NAME=' | cut -d= -f 2 | sed 's/"//g') $ tori_os=$(tori os) $ test -n "$os_name" $ test -n "$tori_os"