More working commands

This commit is contained in:
2026-08-11 13:56:50 +02:00
parent bf8c5b7e89
commit abb70f29ff
6 changed files with 204 additions and 14 deletions
+8 -3
View File
@@ -14,6 +14,7 @@
(git 'init)
(check-true (git-repository?))
(check-equal? (git-current-branch) "master")
(check-equal? (git 'branch-current) "master")
(check-true (git-clean?))
(git 'config "user.name" "Racket Git Test")
@@ -83,7 +84,8 @@
(git 'commit "work change")
(check-equal? (file->string (build-path "sub" "hello.txt")) "work\n")
(git 'checkout "master")
(check-equal? (git 'branch-current) "work")
(git 'switch "master")
(check-equal? (file->string (build-path "sub" "hello.txt")) "changed\n")
(check-equal? (git-current-branch) "master")
(check-not-false (member "work" (git 'branch)))
@@ -92,7 +94,7 @@
(call-with-output-file (build-path "sub" "hello.txt")
#:exists 'truncate/replace
(lambda (out) (displayln "dirty" out)))
(check-exn exn:fail? (lambda () (git 'checkout "work")))
(check-exn exn:fail? (lambda () (git 'switch "work")))
(check-equal? (git-current-branch) "master")
(check-equal? (file->string (build-path "sub" "hello.txt")) "dirty\n")
(call-with-output-file (build-path "sub" "hello.txt")
@@ -107,7 +109,10 @@
(check-equal? (git 'tag) '("v0.1"))
(git 'checkout "v0.1")
(check-false (git-current-branch))
(git 'checkout "master")
(check-false (git 'branch-current))
(check-exn exn:fail? (lambda () (git 'switch "missing")))
(git 'switch "master")
(check-equal? (git 'branch-current) "master")
(git 'tag '-d "v0.1")
(check-equal? (git 'tag) '())