diff options
| author | Lars-Dominik Braun <lars@6xq.net> | 2022-04-30 15:39:34 +0200 |
|---|---|---|
| committer | Lars-Dominik Braun <lars@6xq.net> | 2022-06-06 13:26:45 +0200 |
| commit | 0972feaff1f766c1759d0b89876132ae473725ce (patch) | |
| tree | ab6161f8ed2c2445836bf0a0b933589e0201ca73 /tests/hackage.scm | |
| parent | 2c5d18e421e6c06f4a969f98585ec41aae8eb2e4 (diff) | |
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/hackage.scm')
| -rw-r--r-- | tests/hackage.scm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hackage.scm b/tests/hackage.scm index 38f75b268e8..15309a33814 100644 --- a/tests/hackage.scm +++ b/tests/hackage.scm | |||
| @@ -156,6 +156,12 @@ library | |||
| 156 | Exposed-Modules: | 156 | Exposed-Modules: |
| 157 | Test.QuickCheck.Exception") | 157 | Test.QuickCheck.Exception") |
| 158 | 158 | ||
| 159 | (define test-read-cabal-2 | ||
| 160 | "name: test-me | ||
| 161 | common defaults | ||
| 162 | if os(foobar) { cc-options: -DBARBAZ } | ||
| 163 | ") ; Intentional newline. | ||
| 164 | |||
| 159 | (test-begin "hackage") | 165 | (test-begin "hackage") |
| 160 | 166 | ||
| 161 | (define-syntax-rule (define-package-matcher name pattern) | 167 | (define-syntax-rule (define-package-matcher name pattern) |
| @@ -471,6 +477,16 @@ executable cabal | |||
| 471 | #t) | 477 | #t) |
| 472 | (x (pk 'fail x #f)))) | 478 | (x (pk 'fail x #f)))) |
| 473 | 479 | ||
| 480 | (test-assert "read-cabal test: if brackets on the same line" | ||
| 481 | (match (call-with-input-string test-read-cabal-2 read-cabal) | ||
| 482 | ((("name" ("test-me")) | ||
| 483 | ('section 'common "defaults" | ||
| 484 | (('if ('os "foobar") | ||
| 485 | (("cc-options" ("-DBARBAZ "))) | ||
| 486 | ())))) | ||
| 487 | #t) | ||
| 488 | (x (pk 'fail x #f)))) | ||
| 489 | |||
| 474 | (define test-cabal-import | 490 | (define test-cabal-import |
| 475 | "name: foo | 491 | "name: foo |
| 476 | version: 1.0.0 | 492 | version: 1.0.0 |
