diff --git a/Makefile.mk b/Makefile.mk index d5dc909..e83d034 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -5,11 +5,11 @@ package-zipper "main.rkt") -(makefile rash-git-cli - (target all +(makefile 'rash-git-cli + (target 'all (displayln "make clean, make zip, make status, make sync")) - (target clean + (target 'clean (for-each (λ (f) (displayln f) (rm-f f)) (list-files "." #px"([.]bak|~)$" #:recursive #t)) (for-each (λ (d) (displayln d) (rm-rf d)) @@ -19,26 +19,30 @@ (list-files "scribblings" #px"[.](css|js|html)$"))) ) - (target zip - (deps clean) + (target 'ver + (displayln (git 'next-version)) + ) + + (target 'zip + (deps 'clean) (zip-package #:exclude '(".git" ".gitignore"))) - (target status + (target 'status { git status - }) + }) - (target sync + (target 'sync { git status git add -A git commit git push - }) + }) - (target pull + (target 'pull { git pull - }) + }) ) diff --git a/README.md b/README.md index c118f34..1ff3a5b 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,10 @@ strings and parenthesized Racket expressions keep their normal Racket meaning. The package depends on `git-cli`, `rash`, and `linea`. `git-cli` does not depend on this package. + + +## Package tests + +The package tests validate the Rash/Linea binding without invoking an external +Git executable. Executable examples are excluded from `raco test --package`; +they remain available as examples for interactive use. diff --git a/info.rkt b/info.rkt index 3f55f45..09be575 100644 --- a/info.rkt +++ b/info.rkt @@ -2,7 +2,7 @@ (define collection "rash-git-cli") (define pkg-desc "Rash line-mode integration for git-cli") -(define version "0.1.0") +(define version "0.1.5") (define pkg-authors '("Hans Dijkema")) (define license 'MIT) @@ -17,5 +17,9 @@ "racket-doc" "scribble-lib")) +;; Example programs are executable demonstrations, not package tests. +(define test-omit-paths + '("examples")) + (define scribblings - '(("scribblings/rash-git-cli.scrbl" () ("rash-git-cli")))) + '(("scribblings/rash-git-cli.scrbl" () ("rash-git-cli")))) \ No newline at end of file diff --git a/scribblings/rash-git-cli.scrbl b/scribblings/rash-git-cli.scrbl index b882208..6302e0d 100644 --- a/scribblings/rash-git-cli.scrbl +++ b/scribblings/rash-git-cli.scrbl @@ -35,3 +35,10 @@ Quoted strings and parenthesized Racket expressions retain their normal Racket meaning. The base @tt{git-cli} package has no dependency on Rash, Linea, or this package. + +@section{Testing} + +The package tests verify the Rash/Linea integration without invoking an +external Git executable. This keeps the package tests independent of the host +operating system, PATH configuration, current directory, and installed Git +software. diff --git a/tests/rash.rkt b/tests/rash.rkt index c4a8d3b..dddaf33 100644 --- a/tests/rash.rkt +++ b/tests/rash.rkt @@ -1,64 +1,22 @@ #lang racket (require rackunit - racket/file - linea/read) + rash-git-cli + (for-syntax racket/base + rackunit + linea/line-macro-prop)) -(define tmp (make-temporary-file "rash-git-cli~a" 'directory)) +;; In Racket expression mode, `git` remains the first-class procedure +;; exported by git-cli. Inspecting it must not invoke Git. +(check-true (procedure? git)) -(dynamic-wind - void - (λ () - (define module-path (build-path tmp "Rash.rkt")) +;; The same binding must also be marked as a Linea line macro. This verifies +;; the Rash integration without depending on an external Git executable. +(define-syntax (check-git-line-binding stx) + (define binding + (syntax-local-value #'git (λ () #f))) + (check-not-false binding) + (check-true (line-macro? binding)) + #'(void)) - (call-with-output-file module-path - #:exists 'truncate/replace - (λ (out) - (displayln "#lang rash" out) - (displayln "(require rash-git-cli)" out))) - - (define module-name `(file ,(path->string module-path))) - - (parameterize ([current-directory tmp]) - (dynamic-require module-name #f)) - - (define ns (module->namespace module-name)) - (parameterize ([current-directory tmp] - [current-namespace ns]) - ;; In expression mode the same binding remains callable as git-cli's - ;; first-class Git procedure. - (check-true (eval #'(procedure? git))) - - ;; The Rash line form initializes a repository. - (define init-line - (linea-read-syntax 'drracket-interaction - (open-input-string "git init\n"))) - (eval init-line) - (check-true (directory-exists? (build-path tmp ".git"))) - - (check-true (eval #'(git 'config 'set! "user.name" "Rash Test"))) - (check-true (eval #'(git 'config 'set! "user.email" "rash@example.invalid"))) - - (call-with-output-file (build-path tmp "test.txt") - #:exists 'truncate/replace - (λ (out) - (displayln "rash" out))) - - (eval - (linea-read-syntax 'drracket-interaction - (open-input-string "git add test.txt\n"))) - - (check-true - (eval - (linea-read-syntax 'drracket-interaction - (open-input-string - "git commit -m \"Rash commit\"\n")))) - - (check-equal? - (eval - (linea-read-syntax 'drracket-interaction - (open-input-string "git status\n"))) - '()) - (check-equal? (eval #'(git 'status)) '()))) - (λ () - (delete-directory/files tmp #:must-exist? #f))) +(check-git-line-binding)