Skip to content

Commit 35e301f

Browse files
authored
Merge pull request #80 from jayvdb/test-windows-paths
Test Windows paths in program args
2 parents 89d20d1 + 3c2604e commit 35e301f

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
@@ -393,6 +393,66 @@ def test_classifier(self, run_mock):
393393
self.assertIsNone(stdout)
394394
self.assertIsNone(stderr)
395395

396+
@patch("jgo.jgo._run")
397+
def test_program_arg_path_windows_drive(self, run_mock):
398+
parser = jgo_parser()
399+
argv = [
400+
"-r",
401+
"clojars=https://clojars.org/repo/",
402+
"mvxcvi:cljstyle",
403+
"fix",
404+
"c:/path/to/file.clj",
405+
]
406+
407+
run(parser, argv)
408+
self.assertTrue(run_mock.called)
409+
workspace = run_mock.call_args.args[0]
410+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
411+
jvm_args = run_mock.call_args.args[2]
412+
program_args = run_mock.call_args.args[3]
413+
additional_jars = run_mock.call_args.args[4]
414+
stdout = run_mock.call_args.args[5]
415+
stderr = run_mock.call_args.args[6]
416+
self.assertIsInstance(workspace, str)
417+
self.assertIsInstance(primary_endpoint, Endpoint)
418+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
419+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
420+
self.assertEqual(jvm_args, [])
421+
self.assertEqual(program_args, ["fix", "c:/path/to/file.clj"])
422+
self.assertEqual(additional_jars, [])
423+
self.assertIsNone(stdout)
424+
self.assertIsNone(stderr)
425+
426+
@patch("jgo.jgo._run")
427+
def test_program_arg_path_windows_sep(self, run_mock):
428+
parser = jgo_parser()
429+
argv = [
430+
"-r",
431+
"clojars=https://clojars.org/repo/",
432+
"mvxcvi:cljstyle",
433+
"fix",
434+
"c:\\path\\to\\file.clj",
435+
]
436+
437+
run(parser, argv)
438+
self.assertTrue(run_mock.called)
439+
workspace = run_mock.call_args.args[0]
440+
primary_endpoint: Endpoint = run_mock.call_args.args[1]
441+
jvm_args = run_mock.call_args.args[2]
442+
program_args = run_mock.call_args.args[3]
443+
additional_jars = run_mock.call_args.args[4]
444+
stdout = run_mock.call_args.args[5]
445+
stderr = run_mock.call_args.args[6]
446+
self.assertIsInstance(workspace, str)
447+
self.assertIsInstance(primary_endpoint, Endpoint)
448+
self.assertEqual(primary_endpoint.groupId, "mvxcvi")
449+
self.assertEqual(primary_endpoint.artifactId, "cljstyle")
450+
self.assertEqual(jvm_args, [])
451+
self.assertEqual(program_args, ["fix", "c:\\path\\to\\file.clj"])
452+
self.assertEqual(additional_jars, [])
453+
self.assertIsNone(stdout)
454+
self.assertIsNone(stderr)
455+
396456
@patch("jgo.jgo.launch_java")
397457
def test_explicit_main_class(self, launch_java_mock):
398458
parser = jgo_parser()

0 commit comments

Comments
 (0)