Add test to check --json=v2 format

This commit is contained in:
Carlos Álvaro 2021-02-06 21:11:55 +01:00
parent a20b601120
commit 7ca79553f0
No known key found for this signature in database
GPG Key ID: AFEB19BC24ACCFE5

View File

@ -6,6 +6,19 @@ require "cmd/info"
require "cmd/shared_examples/args_parse"
describe "brew info" do
let(:tarball) do
if OS.linux?
TEST_FIXTURE_DIR/"tarballs/testball-0.1-linux.tbz"
else
TEST_FIXTURE_DIR/"tarballs/testball-0.1.tbz"
end
end
let(:expected_output) {
<<~EOS
{"formulae":[{"name":"testball","full_name":"testball","tap":"homebrew/core","oldname":null,"aliases":[],"versioned_formulae":[],"desc":"Some test","license":null,"homepage":"https://brew.sh/testball","versions":{"stable":"0.1","head":null,"bottle":false},"urls":{"stable":{"url":"file://#{tarball}","tag":null,"revision":null}},"revision":0,"version_scheme":0,"bottle":{},"keg_only":false,"bottle_disabled":false,"options":[{"option":"--with-foo","description":"Build with foo"}],"build_dependencies":[],"dependencies":[],"recommended_dependencies":[],"optional_dependencies":[],"uses_from_macos":[],"requirements":[],"conflicts_with":[],"caveats":null,"installed":[],"linked_keg":null,"pinned":false,"outdated":false,"deprecated":false,"deprecation_date":null,"deprecation_reason":null,"disabled":false,"disable_date":null,"disable_reason":null}],"casks":[]}
EOS
}
it_behaves_like "parseable arguments"
it "prints as json with the --json=v1 flag", :integration_test do
@ -26,6 +39,13 @@ describe "brew info" do
.and be_a_success
end
it "check --json=v2 format", :integration_test do
setup_test_formula "testball"
expect { brew "info", "testball", "--json=v2" }
.to output(expected_output).to_stdout
end
describe Homebrew do
describe "::github_remote_path" do
let(:remote) { "https://github.com/Homebrew/homebrew-core" }