git.fiddlerwoaroof.com
Browse code

fix: fix tests

Edward Langley authored on 24/10/2023 02:31:33
Showing 4 changed files
... ...
@@ -36,6 +36,7 @@
36 36
 
37 37
                ;; stable programmer interface
38 38
                (:file "porcelain" :depends-on ("package" "git" "commit"))))
39
+
39 40
 (defsystem :co.fwoar.cl-git/tests
40 41
   :description ""
41 42
   :author "Ed L <edward@elangley.org>"
... ...
@@ -44,7 +45,7 @@
44 45
                #:uiop
45 46
                #:serapeum
46 47
                #:fiveam
47
-               #:cl-git)
48
+               #:co.fwoar.cl-git)
48 49
   :serial t
49 50
   :components ((:module "tests"
50 51
                 :components ((:file "tests")
... ...
@@ -149,3 +149,5 @@
149 149
 
150 150
 (defmethod component ((component (eql :hash)) (object git-object))
151 151
   (hash object))
152
+(defmethod component ((component (eql :hash)) (object git-ref))
153
+  (ref-hash object))
... ...
@@ -30,9 +30,9 @@
30 30
 (fiveam:in-suite :fwoar.cl-git.branch-resolution)
31 31
 
32 32
 (fiveam:def-test simple ()
33
-  (5am:is (typep (git:with-repository (:branch-resolution)
34
-                   (git:repository))
33
+  (5am:is (typep (co.fwoar.git:with-repository (:branch-resolution)
34
+                   (co.fwoar.git:repository))
35 35
                  'fake-repository))
36 36
   (5am:is (equal *expected-branches*
37
-                 (git:with-repository (:branch-resolution)
38
-                   (git:git (branches))))))
37
+                 (co.fwoar.git:with-repository (:branch-resolution)
38
+                   (co.fwoar.git:git (branches))))))
... ...
@@ -9,9 +9,11 @@
9 9
   :in :fwoar.cl-git)
10 10
 (fiveam:in-suite :fwoar.cl-git.git-objects)
11 11
 
12
-(fw.lu:defclass+ fake-ref ()
13
-  ((%repo :initarg :repo :reader repo)
14
-   (%hash :initarg :hash :reader hash)))
12
+(defclass fake-ref (fwoar.cl-git::git-ref)
13
+  ())
14
+(defun fake-ref (repo hash)
15
+  (fwoar.lisputils:new 'fake-ref repo hash))
16
+
15 17
 (defmethod fwoar.cl-git::ref ((repo (eql *fake-repo*)) hash)
16 18
   (fake-ref repo hash))
17 19
 
... ...
@@ -21,8 +23,9 @@
21 23
         (object (fwoar.cl-git::extract-loose-object
22 24
                  nil
23 25
                  (asdf:system-relative-pathname
24
-                  :cl-git
25
-                  "tests/sample-git-objects/hello-world-commit.git-obj"))))
26
+                  :co.fwoar.cl-git
27
+                  "tests/sample-git-objects/hello-world-commit.git-obj")
28
+                 (make-instance 'fake-ref :hash "the-hash"))))
26 29
     (5am:is (typep object 'fwoar.cl-git::git-commit))
27 30
     (5am:is (equal "hello, git!
28 31
 "
... ...
@@ -36,9 +39,9 @@
36 39
     (5am:is (equal ()
37 40
                    (fwoar.cl-git:component :parents object)))
38 41
     (5am:is (equal "1da546ab4697b719efb62f11fd785d6ad3b226d2"
39
-                   (hash (fwoar.cl-git:component :tree object))))
42
+                   (fwoar.cl-git::ref-hash (fwoar.cl-git:component :tree object))))
40 43
     (5am:is (equal *fake-repo*
41
-                   (repo (fwoar.cl-git:component :tree object))))
44
+                   (fwoar.cl-git::ref-repo (fwoar.cl-git:component :tree object))))
42 45
     (5am:is (equal '(("author" "L Edgley <foo@bar.com> 1605513585 -0800")
43 46
                      ("committer" "Ed L <el-github@elangley.org> 1605513585 -0800")
44 47
                      ("tree" "1da546ab4697b719efb62f11fd785d6ad3b226d2"))
... ...
@@ -51,8 +54,9 @@
51 54
   (let ((object (fwoar.cl-git::extract-loose-object
52 55
                  nil
53 56
                  (asdf:system-relative-pathname
54
-                  :cl-git
55
-                  "tests/sample-git-objects/hello-world-tree.git-obj"))))
57
+                  :co.fwoar.cl-git
58
+                  "tests/sample-git-objects/hello-world-tree.git-obj")
59
+                 (make-instance 'fake-ref :hash "the-hash"))))
56 60
     (5am:is (typep object 'fwoar.cl-git::git-tree))
57 61
     (let* ((entries (fwoar.cl-git::entries object))
58 62
            (entry (progn (5am:is (= (length entries) 1))
... ...
@@ -70,10 +74,10 @@
70 74
 (defmethod fwoar.cl-git::pack-files ((repo (eql *fake-repo*)))
71 75
   (list
72 76
    (fwoar.cl-git::pack (asdf:system-relative-pathname
73
-                        :cl-git
77
+                        :co.fwoar.cl-git
74 78
                         "tests/sample-git-objects/hello-world-pack.idx")
75 79
                        (asdf:system-relative-pathname
76
-                        :cl-git
80
+                        :co.fwoar.cl-git
77 81
                         "tests/sample-git-objects/hello-world-pack.pack")
78 82
                        repo)))
79 83
 
... ...
@@ -101,9 +105,9 @@
101 105
                    (fwoar.cl-git:component :parents object)))
102 106
     (let ((fwoar.cl-git::*git-repository* *fake-repo*))
103 107
       (5am:is (equal "1da546ab4697b719efb62f11fd785d6ad3b226d2"
104
-                     (hash (fwoar.cl-git:component :tree object))))
108
+                     (fwoar.cl-git::ref-hash (fwoar.cl-git:component :tree object))))
105 109
       (5am:is (equal *fake-repo*
106
-                     (repo (fwoar.cl-git:component :tree object)))))
110
+                     (fwoar.cl-git::ref-repo (fwoar.cl-git:component :tree object)))))
107 111
     (5am:is (equal '(("author" "L Edgley <foo@bar.com> 1605513585 -0800")
108 112
                      ("committer" "Ed L <el-github@elangley.org> 1605513585 -0800")
109 113
                      ("tree" "1da546ab4697b719efb62f11fd785d6ad3b226d2"))