From 509c79230fa73593024b5f56991eb4d6c0899e57 Mon Sep 17 00:00:00 2001 From: JoeWang1127 Date: Thu, 9 May 2024 23:19:06 +0000 Subject: [PATCH] add shell test --- .../src/main/java/com/example_com_sample.txt | 0 .../src/main/java/io/example_io_sample.txt | 0 .../test/utilities_unit_tests.py | 24 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/com/example_com_sample.txt create mode 100644 library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/io/example_io_sample.txt diff --git a/library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/com/example_com_sample.txt b/library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/com/example_com_sample.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/io/example_io_sample.txt b/library_generation/test/resources/test_mv_src/destination/java_gapic_srcjar/samples/snippets/generated/src/main/java/io/example_io_sample.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/library_generation/test/utilities_unit_tests.py b/library_generation/test/utilities_unit_tests.py index 30cfd49b0e..64339329f3 100644 --- a/library_generation/test/utilities_unit_tests.py +++ b/library_generation/test/utilities_unit_tests.py @@ -113,6 +113,30 @@ def test_sh_util_nonexistent_function_fails(self): with self.assertRaises(RuntimeError): result = util.sh_util("nonexistent_function") + def test_mv_src_files_sample_suffix_io_succeeds(self): + previous_dir = os.getcwd() + os.chdir(f"{resources_dir}/test_mv_src") + util.sh_util("mv_src_files samples main destination io") + self.assertTrue( + os.path.isfile( + "destination/samples/snippets/generated/io/example_io_sample.txt" + ) + ) + shutil.rmtree("destination/samples") + os.chdir(previous_dir) + + def test_mv_src_files_sample_suffix_com_succeeds(self): + previous_dir = os.getcwd() + os.chdir(f"{resources_dir}/test_mv_src") + util.sh_util("mv_src_files samples main destination") + self.assertTrue( + os.path.isfile( + "destination/samples/snippets/generated/com/example_com_sample.txt" + ) + ) + shutil.rmtree("destination/samples") + os.chdir(previous_dir) + def test_eprint_valid_input_succeeds(self): test_input = "This is some test input" # create a stdio capture object