Removed tests, because they should have been done in git-cli.
This commit is contained in:
+16
-58
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user