def test_command_all(self): args = CommandLineArgs( ["buck", "--help", "--version", "clean", "--help", "all"]) self.assertEqual(args.command, "clean") self.assertEqual(args.buck_options, ["--help", "--version"]) self.assertEqual(args.command_options, ["--help", "all"]) self.assertTrue(args.is_help())
def test_global_version(self): args = CommandLineArgs(["buck", "--version"]) self.assertEqual(args.command, None) self.assertEqual(args.buck_options, ["--version"]) self.assertEqual(args.command_options, []) self.assertTrue(args.is_help(), "--version does not require a build") self.assertTrue(args.is_version())
def test_run_command_help_for_program_and_buck(self): args = CommandLineArgs( ["buck", "--help", "run", "//some:cli", "--", "--help"]) self.assertEqual(args.command, "run") self.assertEqual(args.buck_options, ["--help"]) self.assertEqual(args.command_options, ["//some:cli"]) self.assertFalse(args.is_help(), "Global --help ignored with command")
def test_run_command_help_for_program_and_command(self): args = CommandLineArgs( ["buck", "run", "--help", "//some:cli", "--", "--help"]) self.assertEqual(args.command, "run") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, ["--help", "//some:cli"]) self.assertTrue(args.is_help())
def test_command_all(self): args = CommandLineArgs( ["buck", "--help", "--version", "clean", "--help", "all"] ) self.assertEqual(args.command, "clean") self.assertEqual(args.buck_options, ["--help", "--version"]) self.assertEqual(args.command_options, ["--help", "all"]) self.assertTrue(args.is_help())
def test_help_command(self): args = CommandLineArgs(["buck", "--help", "clean"]) self.assertEqual(args.command, "clean") self.assertEqual(args.buck_options, ["--help"]) self.assertEqual(args.command_options, []) self.assertFalse(args.is_help(), "Global --help ignored with command")
def test_global_help(self): args = CommandLineArgs(["buck", "--help"]) self.assertEqual(args.command, None) self.assertEqual(args.buck_options, ["--help"]) self.assertEqual(args.command_options, []) self.assertTrue(args.is_help())
def test_single_command(self): args = CommandLineArgs(["buck", "clean"]) self.assertEqual(args.command, "clean") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, []) self.assertFalse(args.is_help())
def test_empty_command(self): args = CommandLineArgs(["buck"]) self.assertEqual(args.command, None) self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, []) self.assertTrue(args.is_help(), "With no arguments should show help")
def test_run_command(self): args = CommandLineArgs(["buck", "run", "--help"]) self.assertEqual(args.command, "run") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, ["--help"]) self.assertTrue(args.is_help())
def test_run_command_help_for_program_and_buck(self): args = CommandLineArgs(["buck", "--help", "run", "//some:cli", "--", "--help"]) self.assertEqual(args.command, "run") self.assertEqual(args.buck_options, ["--help"]) self.assertEqual(args.command_options, ["//some:cli"]) self.assertFalse(args.is_help(), "Global --help ignored with command")
def test_run_command_help_for_program(self): args = CommandLineArgs(["buck", "run", "//some:cli", "--", "--help"]) self.assertEqual(args.command, "run") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, ["//some:cli"]) self.assertFalse(args.is_help())
def test_short_help_after_external(self): args = CommandLineArgs(["buck", "test", "--", "-h"]) self.assertEqual(args.command, "test") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, []) self.assertFalse(args.is_help())
def test_short_help_after_command(self): args = CommandLineArgs(["buck", "clean", "-h"]) self.assertEqual(args.command, "clean") self.assertEqual(args.buck_options, []) self.assertEqual(args.command_options, ["-h"]) self.assertTrue(args.is_help())