Skip to content

Commit 135435e

Browse files
committed
Test Windows paths in program args
1 parent 6f3f955 commit 135435e

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/test_run.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,54 @@ def test_classifier(self, run_mock):
368368
self.assertIsNone(stdout)
369369
self.assertIsNone(stderr)
370370

371+
@patch("jgo.jgo._run")
372+
def test_program_arg_path_windows_drive(self, run_mock):
373+
parser = jgo_parser()
374+
argv = ["mvxcvi:cljstyle", "fix", "c:/path/to/file.clj"]
375+
376+
run(parser, argv)
377+
self.assertTrue(run_mock.called)
378+
workspace = run_mock.call_args.args[0]
379+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
380+
jvm_args = run_mock.call_args.args[2]
381+
program_args = run_mock.call_args.args[3]
382+
additional_jars = run_mock.call_args.args[4]
383+
stdout = run_mock.call_args.args[5]
384+
stderr = run_mock.call_args.args[6]
385+
self.assertIsInstance(workspace, str)
386+
self.assertIsInstance(primary_endpoint, Endpoint)
387+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
388+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
389+
self.assertEqual(jvm_args, [])
390+
self.assertEqual(program_args, ["fix", "c:/path/to/file.clj"])
391+
self.assertEqual(additional_jars, [])
392+
self.assertIsNone(stdout)
393+
self.assertIsNone(stderr)
394+
395+
@patch("jgo.jgo._run")
396+
def test_program_arg_path_windows_sep(self, run_mock):
397+
parser = jgo_parser()
398+
argv = ["mvxcvi:cljstyle", "fix", "c:\\path\\to\\file.clj"]
399+
400+
run(parser, argv)
401+
self.assertTrue(run_mock.called)
402+
workspace = run_mock.call_args.args[0]
403+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
404+
jvm_args = run_mock.call_args.args[2]
405+
program_args = run_mock.call_args.args[3]
406+
additional_jars = run_mock.call_args.args[4]
407+
stdout = run_mock.call_args.args[5]
408+
stderr = run_mock.call_args.args[6]
409+
self.assertIsInstance(workspace, str)
410+
self.assertIsInstance(primary_endpoint, Endpoint)
411+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
412+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
413+
self.assertEqual(jvm_args, [])
414+
self.assertEqual(program_args, ["fix", "c:\\path\\to\\file.clj"])
415+
self.assertEqual(additional_jars, [])
416+
self.assertIsNone(stdout)
417+
self.assertIsNone(stderr)
418+
371419
@patch("jgo.jgo.launch_java")
372420
def test_explicit_main_class(self, launch_java_mock):
373421
parser = jgo_parser()

0 commit comments

Comments
 (0)