Skip to content

Commit 6bb11bb

Browse files
committed
test(melange): share installed app fixture
Extract the repeated Melange app dune-project and emit stanza used by installed runtime_deps tests into a shared helper. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
1 parent bdf4182 commit 6bb11bb

3 files changed

Lines changed: 21 additions & 26 deletions

File tree

test/blackbox-tests/setup-script.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,25 @@ write_menhir_merge_into_sources() {
544544
EOF
545545
}
546546

547+
write_melange_app_using_foo() {
548+
local dir="${1:-app}"
549+
550+
mkdir -p "$dir"
551+
cat > "$dir/dune-project" <<-'EOF'
552+
(lang dune 3.8)
553+
(package (name app))
554+
(using melange 0.1)
555+
EOF
556+
cat > "$dir/dune" <<-'EOF'
557+
(melange.emit
558+
(target output)
559+
(alias mel)
560+
(emit_stdlib false)
561+
(libraries foo)
562+
(preprocess (pps melange.ppx)))
563+
EOF
564+
}
565+
547566
make_melange_virtual_time_project() {
548567
local vlib_public_name="$1"
549568
local impl_public_name="$2"

test/blackbox-tests/test-cases/melange/depend-on-installed-lib-with-dir-target-runtime-deps.t

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,7 @@ Test `melange.runtime_deps` in a library that has been installed
3636

3737
$ write_melange_asset_reader app
3838

39-
$ cat > app/dune-project <<EOF
40-
> (lang dune 3.8)
41-
> (package (name app))
42-
> (using melange 0.1)
43-
> EOF
44-
$ cat > app/dune <<EOF
45-
> (melange.emit
46-
> (target output)
47-
> (alias mel)
48-
> (emit_stdlib false)
49-
> (libraries foo)
50-
> (preprocess (pps melange.ppx)))
51-
> EOF
39+
$ write_melange_app_using_foo app
5240

5341

5442
$ OCAMLPATH=$PWD/prefix/lib/:$OCAMLPATH dune build --root app @mel --debug-dependency-path

test/blackbox-tests/test-cases/melange/installed-library-with-runtime-deps.t

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,7 @@ Test `melange.runtime_deps` in a library that has been installed
3030

3131
$ write_melange_asset_reader app
3232

33-
$ cat > app/dune-project <<EOF
34-
> (lang dune 3.8)
35-
> (package (name app))
36-
> (using melange 0.1)
37-
> EOF
38-
$ cat > app/dune <<EOF
39-
> (melange.emit
40-
> (target output)
41-
> (alias mel)
42-
> (emit_stdlib false)
43-
> (libraries foo)
44-
> (preprocess (pps melange.ppx)))
45-
> EOF
33+
$ write_melange_app_using_foo app
4634

4735

4836
$ OCAMLPATH=$PWD/prefix/lib/:$OCAMLPATH dune build --root app @mel

0 commit comments

Comments
 (0)