From 96f829778aafed68b460c789b6af242dcea13348 Mon Sep 17 00:00:00 2001 From: David Maisonave <47364845+David-Maisonave@users.noreply.github.com> Date: Tue, 20 Aug 2024 21:07:24 -0400 Subject: [PATCH] Adding test scripts used for self unit testing. --- plugins/.gitignore | 1 - plugins/FileMonitor/test_hello_world.bat | 6 ++++++ plugins/FileMonitor/test_hello_world.py | 14 ++++++++++++++ plugins/FileMonitor/test_hello_world2.cmd | 6 ++++++ plugins/FileMonitor/test_hello_world2.py | 14 ++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 plugins/FileMonitor/test_hello_world.bat create mode 100644 plugins/FileMonitor/test_hello_world.py create mode 100644 plugins/FileMonitor/test_hello_world2.cmd create mode 100644 plugins/FileMonitor/test_hello_world2.py diff --git a/plugins/.gitignore b/plugins/.gitignore index a338201..349f21d 100644 --- a/plugins/.gitignore +++ b/plugins/.gitignore @@ -34,7 +34,6 @@ renamefile_settings.cpython-310.pyc /DeleteMe /ATestPlugin /FileMonitor/working -test_hello_world*.* MyDummyFileFrom_test_script_hello_world.txt ## Ignore Visual Studio temporary files, build results, and diff --git a/plugins/FileMonitor/test_hello_world.bat b/plugins/FileMonitor/test_hello_world.bat new file mode 100644 index 0000000..9c59470 --- /dev/null +++ b/plugins/FileMonitor/test_hello_world.bat @@ -0,0 +1,6 @@ +@ECHO OFF +echo Hello, world from batch script! arg = %* + +echo Hello, world from batch script! arg = %* > %~dp0\\MyDummyFileFromBatchTestFor_FileMonitor.txt + +exit /b 0 \ No newline at end of file diff --git a/plugins/FileMonitor/test_hello_world.py b/plugins/FileMonitor/test_hello_world.py new file mode 100644 index 0000000..5b7b19e --- /dev/null +++ b/plugins/FileMonitor/test_hello_world.py @@ -0,0 +1,14 @@ +import sys, os, pathlib, json + +Args = "" +if len(sys.argv) > 1: + Args = sys.argv[1:] +print(f"StdErr: Hello, world from Python script!\nArgs={Args}", file=sys.stderr) + +testFileToCreate = f"{pathlib.Path(__file__).resolve().parent}{os.sep}MyDummyFileFromPython_{pathlib.Path(__file__).stem}.txt" + +pathlib.Path(testFileToCreate).touch() + +print(f"Hello, world from Python script!\nArgs={Args}") + +sys.exit(0) \ No newline at end of file diff --git a/plugins/FileMonitor/test_hello_world2.cmd b/plugins/FileMonitor/test_hello_world2.cmd new file mode 100644 index 0000000..67793ab --- /dev/null +++ b/plugins/FileMonitor/test_hello_world2.cmd @@ -0,0 +1,6 @@ +@ECHO OFF +echo Hello, world#2 from batch script! arg = %* + +echo Hello, world#2 from batch script! arg = %* > %~dp0\\MyDummyFileFromBatch2TestFor_FileMonitor.txt + +exit /b 0 \ No newline at end of file diff --git a/plugins/FileMonitor/test_hello_world2.py b/plugins/FileMonitor/test_hello_world2.py new file mode 100644 index 0000000..d727901 --- /dev/null +++ b/plugins/FileMonitor/test_hello_world2.py @@ -0,0 +1,14 @@ +import sys, os, pathlib, json + +Args = "" +if len(sys.argv) > 1: + Args = sys.argv[1:] +print(f"StdErr: Hello, world from Python script!\nArgs={Args}", file=sys.stderr) + +testFileToCreate = f"{pathlib.Path(__file__).resolve().parent}{os.sep}MyDummyFileFromPython2_{pathlib.Path(__file__).stem}.txt" + +pathlib.Path(testFileToCreate).touch() + +print(f"Hello, world from Python script2!\nArgs={Args}") + +sys.exit(0) \ No newline at end of file