Skip to content

Commit e7fb0f4

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 d899767 commit e7fb0f4

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
@@ -483,6 +483,25 @@ write_bin_pform_inline_tests_fixture() {
483483
: > testlib.ml
484484
}
485485

486+
write_melange_app_using_foo() {
487+
local dir="${1:-app}"
488+
489+
mkdir -p "$dir"
490+
cat > "$dir/dune-project" <<-'EOF'
491+
(lang dune 3.8)
492+
(package (name app))
493+
(using melange 0.1)
494+
EOF
495+
cat > "$dir/dune" <<-'EOF'
496+
(melange.emit
497+
(target output)
498+
(alias mel)
499+
(emit_stdlib false)
500+
(libraries foo)
501+
(preprocess (pps melange.ppx)))
502+
EOF
503+
}
504+
486505
make_melange_virtual_time_project() {
487506
local vlib_public_name="$1"
488507
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)