Beispiel #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())
Beispiel #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())
Beispiel #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")
Beispiel #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())
Beispiel #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())
Beispiel #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")
Beispiel #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())
Beispiel #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())
Beispiel #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")
Beispiel #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())
Beispiel #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")
Beispiel #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())
Beispiel #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())
Beispiel #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())
Beispiel #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())