erg-lang / erg

A statically typed language compatible with Python
http://erg-lang.org
Apache License 2.0
2.68k stars 55 forks source link

Optimize eval tests #380

Closed mtshiba closed 1 year ago

mtshiba commented 1 year ago

Describe the code issue?

Currently, eval tests heavily call eval function. However, this is not lightweight. To speed up testing, it may be necessary to make eval function reusable or to parallelize tests.

Since cargo executes test functions with the #[test] attribute in parallel, it can be solved naively.

Alternatively, we can rewrite

assert_eq!(eval("print! 1"), successful_output("1\n"));
assert_eq!(eval("print! \"abc\""), successful_output("abc\n"));

to

assert_eq!(eval("print! 1, \"abc\""), successful_output("1 abc\n"));

Additional context

No response

Erg version

0.6.3

Python version

None

OS

None