summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-04-30 15:39:34 +0200
committerLars-Dominik Braun <lars@6xq.net>2022-06-06 13:26:45 +0200
commit0972feaff1f766c1759d0b89876132ae473725ce (patch)
treeab6161f8ed2c2445836bf0a0b933589e0201ca73 /tests
parent2c5d18e421e6c06f4a969f98585ec41aae8eb2e4 (diff)
downloadguix-0972feaff1f766c1759d0b89876132ae473725ce.tar.gz
import: cabal: Allow curly brackets in more positions.
* guix/import/cabal.scm (is-layout-property): Do not expect end of line.
(lex-layout-property): Check for newline.
(lex-property): Stop reading on closing curly bracket.
* tests/hackage.scm (test-read-cabal-2): New variable.
("read-cabal test: if brackets on the same line"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/hackage.scm16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index 38f75b268e..15309a3381 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -156,6 +156,12 @@ library
   Exposed-Modules:
     Test.QuickCheck.Exception")
 
+(define test-read-cabal-2
+  "name: test-me
+common defaults
+    if os(foobar) { cc-options: -DBARBAZ }
+") ; Intentional newline.
+
 (test-begin "hackage")
 
 (define-syntax-rule (define-package-matcher name pattern)
@@ -471,6 +477,16 @@ executable cabal
      #t)
     (x (pk 'fail x #f))))
 
+(test-assert "read-cabal test: if brackets on the same line"
+  (match (call-with-input-string test-read-cabal-2 read-cabal)
+    ((("name" ("test-me"))
+        ('section 'common "defaults"
+          (('if ('os "foobar")
+               (("cc-options" ("-DBARBAZ ")))
+               ()))))
+     #t)
+    (x (pk 'fail x #f))))
+
 (define test-cabal-import
   "name: foo
 version: 1.0.0