diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lint.scm | 16 | ||||
-rw-r--r-- | tests/syscalls.scm | 22 |
2 files changed, 35 insertions, 3 deletions
diff --git a/tests/lint.scm b/tests/lint.scm index 4f0196491d..9bc42990ef 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -138,6 +138,14 @@ requests." (define-syntax-rule (with-warnings body ...) (call-with-warnings (lambda () body ...))) +(test-assert "description: not a string" + (->bool + (string-contains (with-warnings + (let ((pkg (dummy-package "x" + (description 'foobar)))) + (check-description-style pkg))) + "invalid description"))) + (test-assert "description: not empty" (->bool (string-contains (with-warnings @@ -191,6 +199,14 @@ requests." "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD).")))) (check-description-style pkg))))) +(test-assert "synopsis: not a string" + (->bool + (string-contains (with-warnings + (let ((pkg (dummy-package "x" + (synopsis #f)))) + (check-synopsis-style pkg))) + "invalid synopsis"))) + (test-assert "synopsis: not empty" (->bool (string-contains (with-warnings diff --git a/tests/syscalls.scm b/tests/syscalls.scm index 24ea8f5e60..71bcbc4d32 100644 --- a/tests/syscalls.scm +++ b/tests/syscalls.scm @@ -78,6 +78,21 @@ (rmdir dir) #t)))) +(test-equal "statfs, ENOENT" + ENOENT + (catch 'system-error + (lambda () + (statfs "/does-not-exist")) + (compose system-error-errno list))) + +(test-assert "statfs" + (let ((fs (statfs "/"))) + (and (file-system? fs) + (> (file-system-block-size fs) 0) + (>= (file-system-blocks-available fs) 0) + (>= (file-system-blocks-free fs) + (file-system-blocks-available fs))))) + (define (user-namespace pid) (string-append "/proc/" (number->string pid) "/ns/user")) @@ -244,15 +259,16 @@ (#f #f) (lo (interface-address lo))))))) -(test-equal "terminal-window-size ENOTTY" - ENOTTY +(test-assert "terminal-window-size ENOTTY" (call-with-input-file "/dev/null" (lambda (port) (catch 'system-error (lambda () (terminal-window-size port)) (lambda args - (system-error-errno args)))))) + ;; Accept EINVAL, which some old Linux versions might return. + (memv (system-error-errno args) + (list ENOTTY EINVAL))))))) (test-assert "terminal-columns" (> (terminal-columns) 0)) |