Пример #1
0
 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())
Пример #2
0
 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())
Пример #3
0
 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")
Пример #4
0
 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())
Пример #5
0
 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())
Пример #6
0
 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")
Пример #7
0
 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())
Пример #8
0
 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())
Пример #9
0
 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")
Пример #10
0
 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())
Пример #11
0
 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")
Пример #12
0
 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())
Пример #13
0
 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())
Пример #14
0
 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())
Пример #15
0
 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())