| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | (define-module (test-bournish)
|
| 21 | #:use-module (guix build bournish)
|
| 22 | #:use-module (system base compile)
|
| 23 | #:use-module (system base language)
|
| 24 | #:use-module (srfi srfi-64))
|
| 25 |
|
| 26 |
|
| 27 | (test-begin "bournish")
|
| 28 |
|
| 29 | (test-equal "single statement"
|
| 30 | '(chdir "/foo")
|
| 31 | (read-and-compile (open-input-string "cd /foo")
|
| 32 | #:from %bournish-language #:to 'scheme))
|
| 33 |
|
| 34 | (test-equal "multiple statements"
|
| 35 | '(begin
|
| 36 | (chdir "/foo")
|
| 37 | (getcwd)
|
| 38 | ((@@ (guix build bournish) ls-command-implementation)))
|
| 39 | (read-and-compile (open-input-string "cd /foo\npwd\nls")
|
| 40 | #:from %bournish-language #:to 'scheme))
|
| 41 |
|
| 42 | (test-equal "rm"
|
| 43 | '(for-each delete-file (list "foo" "bar"))
|
| 44 | (read-and-compile (open-input-string "rm foo bar\n")
|
| 45 | #:from %bournish-language #:to 'scheme))
|
| 46 |
|
| 47 | (test-equal "rm -r"
|
| 48 | '(for-each (@ (guix build utils) delete-file-recursively)
|
| 49 | (list "/foo" "/bar"))
|
| 50 | (read-and-compile (open-input-string "rm -r /foo /bar\n")
|
| 51 | #:from %bournish-language #:to 'scheme))
|
| 52 |
|
| 53 | (test-end "bournish")
|
| 54 |
|