Skip to content

Commit 6cbe3c3

Browse files
committed
Add tests for maintenance_intent
Signed-off-by: ArthurW <[email protected]>
1 parent c30bae2 commit 6cbe3c3

File tree

4 files changed

+89
-44
lines changed

4 files changed

+89
-44
lines changed

test/blackbox-tests/test-cases/config-project-defaults.t

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ generated 'dune-project' file.
44

55
$ touch dune-config
66
$ cat >dune-config <<EOF
7-
> (lang dune 3.17)
7+
> (lang dune 3.18)
88
> (project_defaults
99
> (authors AuthorTest)
1010
> (maintainers MaintainerTest)
11+
> (maintenance_intent "(latest)")
1112
> (license MIT))
1213
> EOF
1314

@@ -33,11 +34,12 @@ Change the version of the config file to one which does not support the
3334

3435
$ sed -i -e '1s|.*|(lang dune 3.16)|' dune-config
3536
$ dune init proj test_proj1 --config-file=dune-config
36-
File "$TESTCASE_ROOT/dune-config", lines 2-5, characters 0-85:
37+
File "$TESTCASE_ROOT/dune-config", lines 2-6, characters 0-118:
3738
2 | (project_defaults
3839
3 | (authors AuthorTest)
3940
4 | (maintainers MaintainerTest)
40-
5 | (license MIT))
41+
5 | (maintenance_intent "(latest)")
42+
6 | (license MIT))
4143
Error: 'project_defaults' is only available since version 3.17 of the dune
4244
language. Please update your dune config file to have (lang dune 3.17).
4345
[1]
@@ -47,7 +49,7 @@ Change the version of the config file to one which does not support the
4749
Check to ensure that the default values are used when optional stanzas are
4850
removed/not used.
4951

50-
$ sed -i -e '3,5c\
52+
$ sed -i -e '3,6c\
5153
> )' dune-config
5254
$ dune init proj test_proj1 --config-file=dune-config
5355
Entering directory 'test_proj1'

test/blackbox-tests/test-cases/dune-project-meta/basic-generate.t

+71-36
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@ Simple test
44
The `dune build` should generate the opam file
55

66
$ cat >dune-project <<EOF
7-
> (lang dune 1.10)
7+
> (lang dune 3.18)
88
> (version 1.0.0)
99
> (name cohttp)
1010
> (source (github mirage/ocaml-cohttp))
1111
> (license ISC)
1212
> (authors "Anil Madhavapeddy" "Rudi Grinberg")
13+
> (maintenance_intent "(latest)")
1314
>
1415
> (generate_opam_files true)
1516
>
1617
> (package
1718
> (name cohttp)
1819
> (synopsis "An OCaml library for HTTP clients and servers")
1920
> (description "A longer description")
21+
> (allow_empty)
2022
> (depends
2123
> (alcotest :with-test)
22-
> (dune (and :build (> 1.5)))
2324
> (foo (and :dev (> 1.5) (< 2.0)))
2425
> (uri (>= 1.9.0))
2526
> (uri (< 2.0.0))
@@ -33,6 +34,7 @@ The `dune build` should generate the opam file
3334
> A really long multi line description that spans across lines to
3435
> make sure that the rendering of long strings stays compatible.
3536
> ")
37+
> (allow_empty)
3638
> (depends
3739
> (cohttp (>= 1.0.2))
3840
> (conduit-async (>= 1.0.3))
@@ -46,6 +48,7 @@ The `dune build` should generate the opam file
4648
> A really long description that is supposed to start with a
4749
> newline since it doesn't escape the line break.
4850
> ")
51+
> (allow_empty)
4952
> (depends
5053
> (cohttp (>= 1.0.2))
5154
> (conduit-lwt (>= 1.0.3))
@@ -58,81 +61,113 @@ The `dune build` should generate the opam file
5861
$ cat cohttp.opam
5962
# This file is generated by dune, edit dune-project instead
6063
opam-version: "2.0"
61-
build: [
62-
["dune" "subst"] {pinned}
63-
["dune" "build" "-p" name "-j" jobs]
64-
["dune" "runtest" "-p" name "-j" jobs] {with-test}
65-
["dune" "build" "-p" name "@doc"] {with-doc}
66-
]
67-
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
68-
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
69-
homepage: "https://github.com/mirage/ocaml-cohttp"
70-
license: "ISC"
7164
version: "1.0.0"
72-
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
7365
synopsis: "An OCaml library for HTTP clients and servers"
7466
description: "A longer description"
67+
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
68+
license: "ISC"
69+
homepage: "https://github.com/mirage/ocaml-cohttp"
70+
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
7571
depends: [
72+
"dune" {>= "3.18"}
7673
"alcotest" {with-test}
77-
"dune" {build & > "1.5"}
7874
"foo" {dev & > "1.5" & < "2.0"}
7975
"uri" {>= "1.9.0"}
8076
"uri" {< "2.0.0"}
8177
"fieldslib" {> "v0.12"}
8278
"fieldslib" {< "v0.13"}
79+
"odoc" {with-doc}
8380
]
81+
build: [
82+
["dune" "subst"] {dev}
83+
[
84+
"dune"
85+
"build"
86+
"-p"
87+
name
88+
"-j"
89+
jobs
90+
"@install"
91+
"@runtest" {with-test}
92+
"@doc" {with-doc}
93+
]
94+
]
95+
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
96+
x-maintenance-intent: ["(latest)"]
8497

8598
$ cat cohttp-async.opam
8699
# This file is generated by dune, edit dune-project instead
87100
opam-version: "2.0"
88-
build: [
89-
["dune" "subst"] {pinned}
90-
["dune" "build" "-p" name "-j" jobs]
91-
["dune" "runtest" "-p" name "-j" jobs] {with-test}
92-
["dune" "build" "-p" name "@doc"] {with-doc}
93-
]
94-
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
95-
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
96-
homepage: "https://github.com/mirage/ocaml-cohttp"
97-
license: "ISC"
98101
version: "1.0.0"
99-
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
100102
synopsis: "HTTP client and server for the Async library"
101103
description: """
102104
A really long multi line description that spans across lines to
103105
make sure that the rendering of long strings stays compatible.
104106
"""
107+
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
108+
license: "ISC"
109+
homepage: "https://github.com/mirage/ocaml-cohttp"
110+
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
105111
depends: [
112+
"dune" {>= "3.18"}
106113
"cohttp" {>= "1.0.2"}
107114
"conduit-async" {>= "1.0.3"}
108115
"async" {>= "v0.10.0"}
109116
"async" {< "v0.12"}
117+
"odoc" {with-doc}
118+
]
119+
build: [
120+
["dune" "subst"] {dev}
121+
[
122+
"dune"
123+
"build"
124+
"-p"
125+
name
126+
"-j"
127+
jobs
128+
"@install"
129+
"@runtest" {with-test}
130+
"@doc" {with-doc}
131+
]
110132
]
133+
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
134+
x-maintenance-intent: ["(latest)"]
111135

112136
$ cat cohttp-lwt.opam
113137
# This file is generated by dune, edit dune-project instead
114138
opam-version: "2.0"
115-
build: [
116-
["dune" "subst"] {pinned}
117-
["dune" "build" "-p" name "-j" jobs]
118-
["dune" "runtest" "-p" name "-j" jobs] {with-test}
119-
["dune" "build" "-p" name "@doc"] {with-doc}
120-
]
121-
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
122-
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
123-
homepage: "https://github.com/mirage/ocaml-cohttp"
124-
license: "ISC"
125139
version: "1.0.0"
126-
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
127140
synopsis: "HTTP client and server for the Lwt library"
128141
description: """
129142
130143
A really long description that is supposed to start with a
131144
newline since it doesn't escape the line break.
132145
"""
146+
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
147+
license: "ISC"
148+
homepage: "https://github.com/mirage/ocaml-cohttp"
149+
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
133150
depends: [
151+
"dune" {>= "3.18"}
134152
"cohttp" {>= "1.0.2"}
135153
"conduit-lwt" {>= "1.0.3"}
136154
"lwt" {>= "5.0.0"}
137155
"lwt" {< "6.0.0"}
156+
"odoc" {with-doc}
138157
]
158+
build: [
159+
["dune" "subst"] {dev}
160+
[
161+
"dune"
162+
"build"
163+
"-p"
164+
name
165+
"-j"
166+
jobs
167+
"@install"
168+
"@runtest" {with-test}
169+
"@doc" {with-doc}
170+
]
171+
]
172+
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
173+
x-maintenance-intent: ["(latest)"]

test/blackbox-tests/test-cases/dune-project-meta/override.t

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Package information fields can be overridden per-package:
22

33
$ cat >dune-project <<EOF
4-
> (lang dune 2.5)
4+
> (lang dune 3.18)
55
> (name foo)
66
> (version 1.0.0)
77
> (source (github mirage/ocaml-cohttp))
88
> (license ISC)
99
> (authors "Anil Madhavapeddy" "Rudi Grinberg")
1010
> (homepage https://my.home.page)
11+
> (maintenance_intent "(none)")
1112
> ;
1213
> (generate_opam_files true)
1314
> ;
@@ -16,7 +17,9 @@ Package information fields can be overridden per-package:
1617
> (version 1.0.1)
1718
> (source (github mirage/foo))
1819
> (license MIT)
19-
> (authors "Foo" "Bar"))
20+
> (authors "Foo" "Bar")
21+
> (maintenance_intent "0.9" "1.0.1")
22+
> (allow_empty))
2023
> EOF
2124

2225
$ dune build @install
@@ -30,10 +33,11 @@ Package information fields can be overridden per-package:
3033
homepage: "https://my.home.page"
3134
bug-reports: "https://github.com/mirage/foo/issues"
3235
depends: [
33-
"dune" {>= "2.5"}
36+
"dune" {>= "3.18"}
37+
"odoc" {with-doc}
3438
]
3539
build: [
36-
["dune" "subst"] {pinned}
40+
["dune" "subst"] {dev}
3741
[
3842
"dune"
3943
"build"
@@ -47,3 +51,4 @@ Package information fields can be overridden per-package:
4751
]
4852
]
4953
dev-repo: "git+https://github.com/mirage/foo.git"
54+
x-maintenance-intent: ["0.9" "1.0.1"]

test/expect-tests/dune_config_file/dune_config_test.ml

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ let%expect_test "cache-check-probability 0.1" =
3030
; project_defaults =
3131
{ authors = Some [ "Author Name <[email protected]>" ]
3232
; maintainers = Some [ "Maintainer Name <[email protected]>" ]
33+
; maintenance_intent = Some [ "(latest)" ]
3334
; license = Some [ "LICENSE" ]
3435
}
3536
; experimental = []
@@ -53,6 +54,7 @@ let%expect_test "cache-storage-mode copy" =
5354
; project_defaults =
5455
{ authors = Some [ "Author Name <[email protected]>" ]
5556
; maintainers = Some [ "Maintainer Name <[email protected]>" ]
57+
; maintenance_intent = Some [ "(latest)" ]
5658
; license = Some [ "LICENSE" ]
5759
}
5860
; experimental = []
@@ -76,6 +78,7 @@ let%expect_test "cache-storage-mode hardlink" =
7678
; project_defaults =
7779
{ authors = Some [ "Author Name <[email protected]>" ]
7880
; maintainers = Some [ "Maintainer Name <[email protected]>" ]
81+
; maintenance_intent = Some [ "(latest)" ]
7982
; license = Some [ "LICENSE" ]
8083
}
8184
; experimental = []

0 commit comments

Comments
 (0)