From 80569850c48229a6beeea4db6ff9b240a6436092 Mon Sep 17 00:00:00 2001 From: bruno Date: Wed, 8 Mar 2023 16:56:26 -0500 Subject: [PATCH] commit everything --- tests/test_execCmd.nim | 11 +++++++++++ tests/test_object.nim | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/test_execCmd.nim create mode 100644 tests/test_object.nim diff --git a/tests/test_execCmd.nim b/tests/test_execCmd.nim new file mode 100644 index 0000000..ec73fe3 --- /dev/null +++ b/tests/test_execCmd.nim @@ -0,0 +1,11 @@ +import osproc + +proc runCommand(cmd: string) = + let (output, exitCode) = execCmdEx(cmd) + echo "Command:", cmd + echo "Output:", output + echo "Exit code:", exitCode + +runCommand("echo Hello") +runCommand("ls -l") +runCommand("invalid command") \ No newline at end of file diff --git a/tests/test_object.nim b/tests/test_object.nim new file mode 100644 index 0000000..98ef5fd --- /dev/null +++ b/tests/test_object.nim @@ -0,0 +1,41 @@ +type + PortState = enum Open, Closed + PortItem = object + port: int + state: PortState + +# A simple container for PortItems +type + PortList = seq[PortItem] + +# Add a new port to the list +proc addPort(portList: var PortList; newPort: PortItem) = + portList.add(newPort) + +# Modify an existing port in the list +proc modifyPort(portList: var PortList; portNum: int; newState: PortState) = + for i in 0..