guix-commits
[Top][All Lists]
Advanced

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

05/08: import: cabal: Document failing syntax through tests.


From: guix-commits
Subject: 05/08: import: cabal: Document failing syntax through tests.
Date: Mon, 6 Jun 2022 07:29:26 -0400 (EDT)

lbraun pushed a commit to branch master
in repository guix.

commit f4763ec37df1aa03569ceff30192f5bf4bd736a8
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Sat May 14 15:38:14 2022 +0200

    import: cabal: Document failing syntax through tests.
    
    * tests/hackage.scm (test-read-cabal-brackets-newline): New variable.
    (test-cabal-no-final-newline): Likewise.
    ("hackage->guix-package test without final newline",
    "read-cabal test: property brackets on new line"): New tests.
---
 tests/hackage.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/hackage.scm b/tests/hackage.scm
index 98f9c34fd2..d7ecd0cc21 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -162,6 +162,16 @@ common defaults
     if os(foobar) { cc-options: -DBARBAZ }
 ") ; Intentional newline.
 
+;; Test opening bracket on new line.
+(define test-read-cabal-brackets-newline
+  "name: test-me
+common defaults
+    build-depends:
+    {  foobar
+    ,  barbaz
+    }
+")
+
 (test-begin "hackage")
 
 (define-syntax-rule (define-package-matcher name pattern)
@@ -334,6 +344,21 @@ executable cabal
 (test-assert "hackage->guix-package test properties without space"
   (eval-test-with-cabal test-cabal-property-no-space match-ghc-foo))
 
+;; There may be no final newline terminating a property.
+(define test-cabal-no-final-newline
+"name: foo
+version: 1.0.0
+homepage: http://test.org
+synopsis: synopsis
+description: description
+license: BSD3
+executable cabal
+  build-depends: HTTP       >= 4000.2.5 && < 4000.3, mtl        >= 2.0      && 
< 3")
+
+(test-expect-fail 1)
+(test-assert "hackage->guix-package test without final newline"
+  (eval-test-with-cabal test-cabal-no-final-newline match-ghc-foo))
+
 ;; Check if-elif-else statements
 (define test-cabal-if
   "name: foo
@@ -509,6 +534,15 @@ executable cabal
      #t)
     (x (pk 'fail x #f))))
 
+(test-expect-fail 1)
+(test-assert "read-cabal test: property brackets on new line"
+  (match (call-with-input-string test-read-cabal-brackets-newline read-cabal)
+    ((("name" ("test-me"))
+        ('section 'common "defaults"
+          (("build-depends" ("foobar ,  barbaz")))))
+     #t)
+    (x (pk 'fail x #f))))
+
 (define test-cabal-import
   "name: foo
 version: 1.0.0



reply via email to

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