guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: import: hackage: Evaluate "-any" and "-none" version comparison o


From: Danny Milosavljevic
Subject: 01/01: import: hackage: Evaluate "-any" and "-none" version comparison operators.
Date: Thu, 12 Jul 2018 14:35:09 -0400 (EDT)

dannym pushed a commit to branch master
in repository guix.

commit e39a44f34010e4439fc3fc4925b3f26b7ca6d719
Author: Danny Milosavljevic <address@hidden>
Date:   Thu Jul 12 14:17:08 2018 +0200

    import: hackage: Evaluate "-any" and "-none" version comparison operators.
    
    * guix/import/cabal.scm (eval-cabal): Modify.
    * tests/hackage.scm (test-cabal-4): New variable and test.
    (test-cabal-5): New variable and test.
    (test-cabal-6): New variable and test.
---
 guix/import/cabal.scm |  2 ++
 tests/hackage.scm     | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm
index cd0a295..4cd09ca 100644
--- a/guix/import/cabal.scm
+++ b/guix/import/cabal.scm
@@ -754,6 +754,8 @@ the ordering operation and the version."
            ((string= spec-op ">") (version>? comp-ver spec-ver))
            ((string= spec-op "<=") (not (version>? comp-ver spec-ver)))
            ((string= spec-op "<") (not (version>=? comp-ver spec-ver)))
+           ((string= spec-op "-any") #t)
+           ((string= spec-op "-none") #f)
            (else
             (raise (condition
                     (&message (message "Failed to evaluate 'impl' test."))))))
diff --git a/tests/hackage.scm b/tests/hackage.scm
index a4de8be..e17851a 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -69,6 +69,65 @@ library
       mtl        >= 2.0      && < 3
 ")
 
+;; Check "-any", "-none" when name is different.
+(define test-cabal-4
+  "name: foo
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+library
+  if impl(ghcjs -any)
+    Build-depends: ghc-a
+  if impl(ghc>=7.2&&<7.6)
+    Build-depends: ghc-b
+  if impl(ghc == 7.8)
+    Build-depends: 
+      HTTP       >= 4000.2.5 && < 4000.3,
+      mtl        >= 2.0      && < 3
+")
+
+;; Check "-any", "-none".
+(define test-cabal-5
+  "name: foo
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+library
+  if impl(ghc == 7.8)
+    Build-depends: 
+      HTTP       >= 4000.2.5 && < 4000.3,
+  if impl(ghc -any)
+    Build-depends: mtl        >= 2.0      && < 3
+  if impl(ghc>=7.2&&<7.6)
+    Build-depends: ghc-b
+")
+
+;; Check "custom-setup".
+(define test-cabal-6
+  "name: foo
+build-type: Custom
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+custom-setup
+  setup-depends: base >= 4.7 && < 5,
+                 Cabal >= 1.24,
+                 haskell-gi == 0.21.*
+library
+  if impl(ghc>=7.2&&<7.6)
+    Build-depends: ghc-b
+  if impl(ghc == 7.8)
+    Build-depends: 
+      HTTP       >= 4000.2.5 && < 4000.3,
+      mtl        >= 2.0      && < 3
+")
+
 ;; A fragment of a real Cabal file with minor modification to check precedence
 ;; of 'and' over 'or', missing final newline, spaces between keywords and
 ;; parentheses and between key and column.
@@ -139,6 +198,18 @@ library
   (eval-test-with-cabal test-cabal-3
                         #:cabal-environment '(("impl" . "ghc-7.8"))))
 
+(test-assert "hackage->guix-package test 4"
+  (eval-test-with-cabal test-cabal-4
+                        #:cabal-environment '(("impl" . "ghc-7.8"))))
+
+(test-assert "hackage->guix-package test 5"
+  (eval-test-with-cabal test-cabal-5
+                        #:cabal-environment '(("impl" . "ghc-7.8"))))
+
+(test-assert "hackage->guix-package test 6"
+  (eval-test-with-cabal test-cabal-6
+                        #:cabal-environment '(("impl" . "ghc-7.8"))))
+
 (test-assert "read-cabal test 1"
   (match (call-with-input-string test-read-cabal-1 read-cabal)
     ((("name" ("test-me"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]