summary refs log tree commit diff
path: root/tests/hackage.scm
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hackage.scm')
-rw-r--r--tests/hackage.scm21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm
index d7ecd0cc21..85a5c2115c 100644
--- a/tests/hackage.scm
+++ b/tests/hackage.scm
@@ -172,6 +172,15 @@ common defaults
     }
 ")
 
+;; Test library with (since Cabal 2.0) and without names.
+(define test-read-cabal-library-name
+  "name: test-me
+library foobar
+    build-depends: foo, bar
+library
+    build-depends: bar, baz
+")
+
 (test-begin "hackage")
 
 (define-syntax-rule (define-package-matcher name pattern)
@@ -507,7 +516,7 @@ executable cabal
 (test-assert "read-cabal test 1"
   (match (call-with-input-string test-read-cabal-1 read-cabal)
     ((("name" ("test-me"))
-      ('section 'library
+      ('section 'library #f
                 (('if ('flag "base4point8")
                       (("build-depends" ("base >= 4.8 && < 5")))
                       (('if ('flag "base4")
@@ -543,6 +552,16 @@ executable cabal
      #t)
     (x (pk 'fail x #f))))
 
+(test-assert "read-cabal test: library name"
+  (match (call-with-input-string test-read-cabal-library-name read-cabal)
+    ((("name" ("test-me"))
+        ('section 'library "foobar"
+          (("build-depends" ("foo, bar"))))
+        ('section 'library #f
+          (("build-depends" ("bar, baz")))))
+     #t)
+    (x (pk 'fail x #f))))
+
 (define test-cabal-import
   "name: foo
 version: 1.0.0