Skip to content

Commit d0da704

Browse files
committed
more jbang tests
1 parent 680af7b commit d0da704

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_jbang_integration.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ def test_graalpy_template(self):
203203
test_file_path = os.path.join(work_dir, test_file)
204204
self.addLocalMavenRepo(test_file_path)
205205

206-
tested_code = "print (f\'This is test text and result is {123456789 * 1000}\')"
207-
expected_text = "This is test text and result is 123456789000"
206+
tested_code = "from termcolor import colored; print(colored('hello java', 'red', attrs=['reverse', 'blink']))"
208207
command = [JBANG_CMD, "--verbose", test_file_path, tested_code]
209208
out, result = run_cmd(command)
210209

211210
self.assertTrue(result == 0, f"Execution failed with code {result}\n command: {command}\n stdout: {out}\n")
212-
self.assertTrue(expected_text in out, f"Expected text:\n{expected_text}\nbut in stdout was:\n{out}")
211+
self.assertTrue("Successfully installed termcolor" in out, f"Expected text:\nSuccessfully installed termcolor\nbut in stdout was:\n{out}")
212+
self.assertTrue("hello java" in out, f"Expected text:\nhello java\nbut in stdout was:\n{out}")
213213

214214
@unittest.skipUnless(is_enabled, "ENABLE_JBANG_INTEGRATION_UNITTESTS is not true")
215215
@unittest.skipUnless('win32' not in sys.platform, "Currently the jbang native image on Win gate fails.")
@@ -227,13 +227,13 @@ def test_graalpy_template_native(self):
227227

228228
test_file_path = os.path.join(work_dir, test_file)
229229
self.addLocalMavenRepo(test_file_path)
230-
tested_code = "print (f\'This is test text and result is {147258369 * 1000}\')"
231-
expected_text = "This is test text and result is 147258369000"
230+
tested_code = "from termcolor import colored; print(colored('hello java', 'red', attrs=['reverse', 'blink']))"
232231
command = [JBANG_CMD, "--verbose", "--native", test_file_path, tested_code]
233232
out, result = run_cmd(command)
234233

235234
self.assertTrue(result == 0, f"Execution failed with code {result}\n command: {command}\n stdout: {out}")
236-
self.assertTrue(expected_text in out, f"Expected text:\n{expected_text}\nbut in stdout was:\n{out}")
235+
self.assertTrue("Successfully installed termcolor" in out, f"Expected text:\nSuccessfully installed termcolor")
236+
self.assertTrue("hello java" in out, f"Expected text:\nhello java\nbut in stdout was:\n{out}")
237237

238238

239239
@unittest.skipUnless(is_enabled, "ENABLE_JBANG_INTEGRATION_UNITTESTS is not true")
@@ -248,13 +248,13 @@ def test_graalpy_local_repo_template(self):
248248
self.assertTrue(result == 0, f"Creating template {template_name} failed")
249249

250250
test_file_path = os.path.join(work_dir, test_file)
251-
tested_code = "print (f\'This is test text and result is {987654321 * 1000}\')"
252-
expected_text = "This is test text and result is 987654321000"
251+
tested_code = "from termcolor import colored; print(colored('hello java', 'red', attrs=['reverse', 'blink']))"
253252
command = [JBANG_CMD, "--verbose", test_file_path, tested_code]
254253
out, result = run_cmd(command)
255254

256255
self.assertTrue(result == 0, f"Execution failed with code {result}\n command: {command}\n stdout: {out}")
257-
self.assertTrue(expected_text in out, f"Expected text:\n{expected_text}\nbut in stdout was:\n{out}")
256+
self.assertTrue("Successfully installed termcolor" in out, f"Expected text:\nSuccessfully installed termcolor")
257+
self.assertTrue("hello java" in out, f"Expected text:\nhello java\nbut in stdout was:\n{out}")
258258

259259

260260
unittest.skip_deselected_test_functions(globals())

0 commit comments

Comments
 (0)