From 33d199b7c53ed64ef997b1540562523c93d3a2e8 Mon Sep 17 00:00:00 2001 From: liulingfei-1 Date: Sun, 10 Aug 2025 00:59:44 +0800 Subject: [PATCH] Fix typos, correct C++ bug, and add Python test --- HelloWorld.py | 3 ++- Helloworld.cpp | 4 ++-- README.md | 4 ++-- tests/test_hello.py | 6 ++++++ 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 tests/test_hello.py diff --git a/HelloWorld.py b/HelloWorld.py index 3568c85..2200e6a 100644 --- a/HelloWorld.py +++ b/HelloWorld.py @@ -1,2 +1,3 @@ #!/usr/bin/python3 -print("Hello,world!") +# Prints "Hello, World!" to the console +print("Hello, World!") diff --git a/Helloworld.cpp b/Helloworld.cpp index 6d8dc27..0203d9e 100644 --- a/Helloworld.cpp +++ b/Helloworld.cpp @@ -1,5 +1,5 @@ -#include +#include int main (){ - std:: cout << "Hello,World!" << std:: endl; + std::cout << "Hello, World!" << std::endl; return 0; } diff --git a/README.md b/README.md index d7d526e..d878d44 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Hello-World- -My first repository in Github +# Hello World +My first repository on GitHub. A collection of Hello World programs in various languages. diff --git a/tests/test_hello.py b/tests/test_hello.py new file mode 100644 index 0000000..eb00827 --- /dev/null +++ b/tests/test_hello.py @@ -0,0 +1,6 @@ +import subprocess +import sys + +def test_python_output(): + result = subprocess.run([sys.executable, "HelloWorld.py"], capture_output=True, text=True, check=True) + assert result.stdout.strip() == "Hello, World!"