Skip to content

Commit

Permalink
Merge pull request #5143 from rjbou/json-test
Browse files Browse the repository at this point in the history
reftest: add json test
  • Loading branch information
rjbou committed May 18, 2022
2 parents d633e59 + b4309f0 commit 424f788
Show file tree
Hide file tree
Showing 5 changed files with 816 additions and 7 deletions.
4 changes: 3 additions & 1 deletion master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ users)
* Check whether the repository might need updating more often [#4935 @kit-ty-kate]
* ✘ It is no longer possible to process actions on packages that depend on a package that was removed upstream [#4969 @altgr]
* Fix (at least some of the) empty conflict explanations [#4982 @kit-ty-kate]
* Fix json double printing [#5143 @rjbou]

## Internal
* Add license and lowerbounds to opam files [#4714 @kit-ty-kate]
Expand Down Expand Up @@ -269,9 +270,9 @@ users)
* Update var-option test with no switch examples [#5025]
* Escape for cmdliner.1.1.1 output change [#5131 @rjbou]
* Add deprectaed flag test [#4523 @kit-ty-kate]
* Escape for cmdliner.1.1.1 output chane [#5131 @rjbou]
* Add deps-only, install formula [#4975 @AltGr]
* Update opam root version test do escape `OPAMROOTVERSION` sed, it matches generated hexa temporary directory names [#5007 @AltGr]
* Add json output test [#5143 @rjbou]
### Engine
* Add `opam-cat` to normalise opam file printing [#4763 @rjbou @dra27] [2.1.0~rc2 #4715]
* Fix meld reftest: open only with failing ones [#4913 @rjbou]
Expand All @@ -295,6 +296,7 @@ users)
* Add unix only tests handling [#5031 @AltGr]
* Add switch-set test [#4910 @kit-ty-kate]
* Replace vars on the right-hand of exports [#5024 @AltGr]
* Add `json-cat` printer, with some automatic remplacements [#5143 @rjbou]

## Github Actions
* Add solver backends compile test [#4723 @rjbou] [2.1.0~rc2 #4720]
Expand Down
7 changes: 2 additions & 5 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1395,11 +1395,8 @@ let apply ?ask t ~requested ?print_requested ?add_roots
)

let resolve t action ?reinstall ~requested request =
if OpamClientConfig.(!r.json_out <> None) then (
OpamJson.append "command-line"
(`A (List.map (fun s -> `String s) (Array.to_list Sys.argv)));
OpamJson.append "switch" (OpamSwitch.to_json t.switch)
);
if OpamClientConfig.(!r.json_out <> None) then
OpamJson.append "switch" (OpamSwitch.to_json t.switch);
OpamRepositoryState.check_last_update ();
let universe =
OpamSwitchState.universe t ~requested ?reinstall action
Expand Down
20 changes: 20 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,26 @@
%{targets}
(run ./run.exe %{bin:opam} %{dep:install-pgocaml.test} %{read-lines:testing-env}))))

(rule
(alias reftest-json.unix)
(enabled_if (= %{os_type} "Unix"))
(action
(diff json.unix.test json.unix.out)))

(alias
(name reftest)
(enabled_if (= %{os_type} "Unix"))
(deps (alias reftest-json.unix)))

(rule
(targets json.unix.out)
(deps root-N0REP0)
(enabled_if (= %{os_type} "Unix"))
(action
(with-stdout-to
%{targets}
(run ./run.exe %{bin:opam} %{dep:json.unix.test} %{read-lines:testing-env}))))

(rule
(alias reftest-legacy-git)
(action
Expand Down

0 comments on commit 424f788

Please sign in to comment.