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..