Btter tests for the package index
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
0.2.9
|
||||
|
||||
- Make package-build tests independent of the directory from which raco test is invoked.
|
||||
- Run Rash smoke tests in an isolated temporary directory and capture expected command output.
|
||||
- Keep successful tests silent under raco test --drdr; unexpected failures still escape normally.
|
||||
- Isolate environment-variable tests with current-environment-variables instead of mutating the process environment.
|
||||
- Declare linea explicitly as a build dependency because the Rash test modules use its reader.
|
||||
|
||||
0.2.7
|
||||
|
||||
- Fix package setup regression in the Racket test suite after the raco command/procedure split.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Portable Unix-style core utilities for Rash, implemented in Racket.
|
||||
|
||||
Version 0.2.7 includes text/pipeline tools (`head`, `tail`, `wc`, `sort`, `uniq`,
|
||||
Version 0.2.9 includes text/pipeline tools (`head`, `tail`, `wc`, `sort`, `uniq`,
|
||||
`cut`, `tee`, `tr`), path and filesystem helpers (`basename`, `dirname`,
|
||||
`realpath`, `readlink`, `stat`, `du`, `df`, `mktemp`), environment commands
|
||||
(`printenv`, `env`), and `date` backed by Gregor.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#lang info
|
||||
|
||||
(define pkg-authors '(hnmdijkema))
|
||||
(define version "0.2.7")
|
||||
(define version "0.2.9")
|
||||
(define license 'MIT)
|
||||
(define collection "rash-coreutils")
|
||||
(define pkg-desc
|
||||
@@ -17,5 +17,4 @@
|
||||
'("racket-doc"
|
||||
"rackunit-lib"
|
||||
"scribble-lib"
|
||||
"linea"
|
||||
"rash"))
|
||||
"linea"))
|
||||
+8
-10
@@ -119,7 +119,6 @@
|
||||
(check-true (regexp-match? #rx"a[/\\]b"
|
||||
(capture-output coreutils-dirname "a/b/c.txt")))
|
||||
|
||||
(define saved-env (getenv "RASH_COREUTILS_TEST"))
|
||||
(define env-output
|
||||
(parameterize ([current-coreutils-command-runner
|
||||
(λ (command)
|
||||
@@ -134,18 +133,17 @@
|
||||
'RASH_COREUTILS_VALUE)))
|
||||
(check-equal? env-output "42\n")
|
||||
|
||||
(dynamic-wind
|
||||
void
|
||||
(λ ()
|
||||
(putenv "RASH_COREUTILS_TEST" "before")
|
||||
(define test-environment
|
||||
(environment-variables-copy (current-environment-variables)))
|
||||
(environment-variables-set!
|
||||
test-environment
|
||||
#"RASH_COREUTILS_TEST"
|
||||
#"before")
|
||||
(parameterize ([current-environment-variables test-environment])
|
||||
(check-equal? (capture-output coreutils-printenv "RASH_COREUTILS_TEST")
|
||||
"before\n"))
|
||||
(λ ()
|
||||
(if saved-env
|
||||
(putenv "RASH_COREUTILS_TEST" saved-env)
|
||||
(putenv "RASH_COREUTILS_TEST" #f))))
|
||||
|
||||
(check-true (regexp-match? #rx"[0-9]{4}-[0-9]{2}-[0-9]{2}T"
|
||||
(check-true (regexp-match? #px"[0-9]{4}-[0-9]{2}-[0-9]{2}T"
|
||||
(capture-output coreutils-date "--iso")))
|
||||
|
||||
(check-exn
|
||||
|
||||
+45
-14
@@ -1,21 +1,52 @@
|
||||
#lang rash
|
||||
|
||||
(require rash-coreutils)
|
||||
(require rackunit
|
||||
racket/file
|
||||
racket/port
|
||||
rash-coreutils)
|
||||
|
||||
mkdir -p rash-coreutils-smoke/a
|
||||
(define test-root
|
||||
(make-temporary-file "rash-coreutils-smoke-~a" 'directory))
|
||||
(define output
|
||||
(open-output-string))
|
||||
(define errors
|
||||
(open-output-string))
|
||||
|
||||
echo hello from rash-coreutils
|
||||
ls -l rash-coreutils-smoke
|
||||
ls *.rkt
|
||||
ls #px"^info[.]rkt$"
|
||||
(dynamic-wind
|
||||
void
|
||||
(λ ()
|
||||
(parameterize ([current-directory test-root]
|
||||
[current-output-port output]
|
||||
[current-error-port errors])
|
||||
{
|
||||
(call-with-output-file "info.rkt"
|
||||
#:exists 'truncate
|
||||
(λ (out)
|
||||
(display "#lang racket/base\n" out)))
|
||||
|
||||
(define x 42)
|
||||
env RASH_COREUTILS_VALUE=(values x) printenv RASH_COREUTILS_VALUE
|
||||
mkdir -p rash-coreutils-smoke/a
|
||||
|
||||
echo one two three | wc -w
|
||||
echo c b a | sort
|
||||
echo hello from rash-coreutils
|
||||
ls -l rash-coreutils-smoke
|
||||
ls *.rkt
|
||||
ls #px"^info[.]rkt$"
|
||||
|
||||
date --iso
|
||||
raco help
|
||||
help
|
||||
rm -r rash-coreutils-smoke
|
||||
(define x 42)
|
||||
env RASH_COREUTILS_VALUE=(values x) printenv RASH_COREUTILS_VALUE
|
||||
|
||||
echo one two three | wc -w
|
||||
date --iso
|
||||
rm -r rash-coreutils-smoke
|
||||
|
||||
(check-false (directory-exists? "rash-coreutils-smoke"))
|
||||
})
|
||||
(check-equal? (get-output-string errors) "")
|
||||
(define text (get-output-string output))
|
||||
(check-true (regexp-match? #rx"hello from rash-coreutils" text))
|
||||
(check-true (regexp-match? #rx"info[.]rkt" text))
|
||||
(check-true (regexp-match? #rx"42" text))
|
||||
(check-true (regexp-match? #rx"\n3\n" text))
|
||||
(check-true (regexp-match? #px"[0-9]{4}-[0-9]{2}-[0-9]{2}T" text)))
|
||||
(λ ()
|
||||
(when (directory-exists? test-root)
|
||||
(delete-directory/files test-root))))
|
||||
|
||||
Reference in New Issue
Block a user