From 40993fecf748462743d6aab88a66c458035faa42 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 28 Aug 2024 22:14:08 -0700 Subject: [PATCH] test: add tests for run_cmd function using echo command --- tests/basic/test_run_cmd.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/basic/test_run_cmd.py b/tests/basic/test_run_cmd.py index e69de29bb..f2e2f6c86 100644 --- a/tests/basic/test_run_cmd.py +++ b/tests/basic/test_run_cmd.py @@ -0,0 +1,23 @@ +import pytest +from aider.run_cmd import run_cmd + +def test_run_cmd_echo(): + command = 'echo Hello, World!' + exit_code, output = run_cmd(command) + + assert exit_code == 0 + assert output.strip() == 'Hello, World!' + +def test_run_cmd_echo_with_quotes(): + command = 'echo "Hello, World!"' + exit_code, output = run_cmd(command) + + assert exit_code == 0 + assert output.strip() == 'Hello, World!' + +def test_run_cmd_invalid_command(): + command = 'invalid_command_that_does_not_exist' + exit_code, output = run_cmd(command) + + assert exit_code != 0 + assert 'command not found' in output.lower() or 'is not recognized' in output.lower()