Skip to content

Commit 3c2604e

Browse files
committed
Test Windows paths in program args
1 parent 6f3f955 commit 3c2604e

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

tests/test_run.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,66 @@ 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 = [
375+
"-r",
376+
"clojars=https://clojars.org/repo/",
377+
"mvxcvi:cljstyle",
378+
"fix",
379+
"c:/path/to/file.clj",
380+
]
381+
382+
run(parser, argv)
383+
self.assertTrue(run_mock.called)
384+
workspace = run_mock.call_args.args[0]
385+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
386+
jvm_args = run_mock.call_args.args[2]
387+
program_args = run_mock.call_args.args[3]
388+
additional_jars = run_mock.call_args.args[4]
389+
stdout = run_mock.call_args.args[5]
390+
stderr = run_mock.call_args.args[6]
391+
self.assertIsInstance(workspace, str)
392+
self.assertIsInstance(primary_endpoint, Endpoint)
393+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
394+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
395+
self.assertEqual(jvm_args, [])
396+
self.assertEqual(program_args, ["fix", "c:/path/to/file.clj"])
397+
self.assertEqual(additional_jars, [])
398+
self.assertIsNone(stdout)
399+
self.assertIsNone(stderr)
400+
401+
@patch("jgo.jgo._run")
402+
def test_program_arg_path_windows_sep(self, run_mock):
403+
parser = jgo_parser()
404+
argv = [
405+
"-r",
406+
"clojars=https://clojars.org/repo/",
407+
"mvxcvi:cljstyle",
408+
"fix",
409+
"c:\\path\\to\\file.clj",
410+
]
411+
412+
run(parser, argv)
413+
self.assertTrue(run_mock.called)
414+
workspace = run_mock.call_args.args[0]
415+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
416+
jvm_args = run_mock.call_args.args[2]
417+
program_args = run_mock.call_args.args[3]
418+
additional_jars = run_mock.call_args.args[4]
419+
stdout = run_mock.call_args.args[5]
420+
stderr = run_mock.call_args.args[6]
421+
self.assertIsInstance(workspace, str)
422+
self.assertIsInstance(primary_endpoint, Endpoint)
423+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
424+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
425+
self.assertEqual(jvm_args, [])
426+
self.assertEqual(program_args, ["fix", "c:\\path\\to\\file.clj"])
427+
self.assertEqual(additional_jars, [])
428+
self.assertIsNone(stdout)
429+
self.assertIsNone(stderr)
430+
371431
@patch("jgo.jgo.launch_java")
372432
def test_explicit_main_class(self, launch_java_mock):
373433
parser = jgo_parser()

0 commit comments

Comments
 (0)