rabbitmq-server/deps/rabbitmq_cli/test/ctl/version_command_test.exs

25 lines
809 B
Elixir
Raw Normal View History

## This Source Code Form is subject to the terms of the Mozilla Public
## License, v. 2.0. If a copy of the MPL was not distributed with this
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
2019-02-14 20:10:22 +08:00
##
2020-03-10 22:39:56 +08:00
## Copyright (c) 2007-2020 VMware, Inc. or its affiliates. All rights reserved.
2019-02-14 20:10:22 +08:00
defmodule VersionCommandTest do
use ExUnit.Case
@command RabbitMQ.CLI.Ctl.Commands.VersionCommand
test "merge_defaults: merges no defaults" do
assert @command.merge_defaults([], %{}) == {[], %{}}
end
test "validate: treats positional arguments as a failure" do
assert @command.validate(["extra-arg"], %{}) == {:validation_failure, :too_many_args}
end
test "validate: treats empty positional arguments and default switches as a success" do
assert @command.validate([], %{}) == :ok
end
end