Skip to content

Commit

Permalink
Test Windows paths in program args
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Jul 31, 2022
1 parent 6f3f955 commit 135435e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,54 @@ def test_classifier(self, run_mock):
self.assertIsNone(stdout)
self.assertIsNone(stderr)

@patch("jgo.jgo._run")
def test_program_arg_path_windows_drive(self, run_mock):
parser = jgo_parser()
argv = ["mvxcvi:cljstyle", "fix", "c:/path/to/file.clj"]

run(parser, argv)
self.assertTrue(run_mock.called)
workspace = run_mock.call_args.args[0]
primary_endpoint: Endpoint = run_mock.call_args.args[1]
jvm_args = run_mock.call_args.args[2]
program_args = run_mock.call_args.args[3]
additional_jars = run_mock.call_args.args[4]
stdout = run_mock.call_args.args[5]
stderr = run_mock.call_args.args[6]
self.assertIsInstance(workspace, str)
self.assertIsInstance(primary_endpoint, Endpoint)
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
self.assertEqual(jvm_args, [])
self.assertEqual(program_args, ["fix", "c:/path/to/file.clj"])
self.assertEqual(additional_jars, [])
self.assertIsNone(stdout)
self.assertIsNone(stderr)

@patch("jgo.jgo._run")
def test_program_arg_path_windows_sep(self, run_mock):
parser = jgo_parser()
argv = ["mvxcvi:cljstyle", "fix", "c:\\path\\to\\file.clj"]

run(parser, argv)
self.assertTrue(run_mock.called)
workspace = run_mock.call_args.args[0]
primary_endpoint: Endpoint = run_mock.call_args.args[1]
jvm_args = run_mock.call_args.args[2]
program_args = run_mock.call_args.args[3]
additional_jars = run_mock.call_args.args[4]
stdout = run_mock.call_args.args[5]
stderr = run_mock.call_args.args[6]
self.assertIsInstance(workspace, str)
self.assertIsInstance(primary_endpoint, Endpoint)
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
self.assertEqual(jvm_args, [])
self.assertEqual(program_args, ["fix", "c:\\path\\to\\file.clj"])
self.assertEqual(additional_jars, [])
self.assertIsNone(stdout)
self.assertIsNone(stderr)

@patch("jgo.jgo.launch_java")
def test_explicit_main_class(self, launch_java_mock):
parser = jgo_parser()
Expand Down

0 comments on commit 135435e

Please sign in to comment.