mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
test: fix stack overflow
This commit is contained in:
parent
0d1e5e5bff
commit
1a26c841a9
8 changed files with 7 additions and 24 deletions
|
@ -11,7 +11,7 @@ repos:
|
|||
- id: cargo-test
|
||||
exclude: ^doc/|^.github/|^.gitmessage|.md
|
||||
name: Cargo test
|
||||
entry: cargo test --features pre-commit -- --nocapture
|
||||
entry: cargo test --features large_thread -- --nocapture
|
||||
language: system
|
||||
pass_filenames: false
|
||||
# - id: rust-clippy
|
||||
|
|
|
@ -51,7 +51,6 @@ traditional_chinese = [
|
|||
]
|
||||
unicode = ["erg_common/unicode", "erg_parser/unicode", "erg_compiler/unicode", "els/unicode"]
|
||||
pretty = ["erg_common/pretty", "erg_parser/pretty", "erg_compiler/pretty", "els/pretty"]
|
||||
pre-commit = []
|
||||
large_thread = [
|
||||
"erg_common/large_thread",
|
||||
"erg_parser/large_thread",
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use erg_common::config::ErgConfig;
|
||||
use erg_common::error::MultiErrorDisplay;
|
||||
use erg_common::spawn::exec_new_thread;
|
||||
use erg_common::traits::Runnable;
|
||||
|
||||
use erg_compiler::context::{Context, ModuleContext};
|
||||
|
@ -20,6 +21,10 @@ fn load_file(path: &'static str) -> Result<ModuleContext, CompileErrors> {
|
|||
|
||||
#[test]
|
||||
fn test_infer_types() -> Result<(), ()> {
|
||||
exec_new_thread(_test_infer_types, "test_infer_types")
|
||||
}
|
||||
|
||||
fn _test_infer_types() -> Result<(), ()> {
|
||||
let module = load_file("tests/infer.er").map_err(|errs| {
|
||||
errs.fmt_all_stderr();
|
||||
})?;
|
||||
|
|
|
@ -28,10 +28,6 @@ Erg internal options, help (help, copyright, license, etc.) and errors are displ
|
|||
|
||||
The compiler makes the display rich.
|
||||
|
||||
## pre-commit
|
||||
|
||||
Used to run tests in pre-commit. It's a bug workaround.
|
||||
|
||||
## large_thread
|
||||
|
||||
Increase the thread stack size. Used for Windows execution and test execution.
|
||||
|
|
|
@ -30,10 +30,6 @@ Erg 内部オプション、ヘルプ (ヘルプ、著作権、ライセンス
|
|||
|
||||
コンパイラが表示をリッチにする。
|
||||
|
||||
## pre-commit
|
||||
|
||||
テストを実行する為に使用される。このフラグがないと特定の環境においてテストが失敗する。バグワークアラウンドである。
|
||||
|
||||
## large_thread
|
||||
|
||||
スレッドのスタックサイズを大きくする。Windowsでの実行やテスト実行のために使用される。
|
||||
|
|
|
@ -26,10 +26,6 @@ Erg 内部选项、帮助(帮助、版权、许可证等)和错误显示为繁
|
|||
|
||||
使得编译器显示丰富内容
|
||||
|
||||
## pre-commit
|
||||
|
||||
用于在预提交中运行测试。这是一个bug解决方案
|
||||
|
||||
## large_thread
|
||||
|
||||
增加线程堆栈大小。用于Windows执行和测试执行
|
||||
|
|
|
@ -26,10 +26,6 @@ Erg 內部選項、幫助(幫助、版權、許可證等)和錯誤顯示為繁
|
|||
|
||||
使得編譯器顯示豐富內容
|
||||
|
||||
## pre-commit
|
||||
|
||||
用于在預提交中運行測試。這是一個bug解決方案
|
||||
|
||||
## large_thread
|
||||
|
||||
增加線程堆棧大小。用于Windows執行和測試執行
|
||||
|
|
|
@ -74,12 +74,7 @@ fn exec_fib() -> Result<(), ()> {
|
|||
|
||||
#[test]
|
||||
fn exec_helloworld() -> Result<(), ()> {
|
||||
// HACK: When running the test with pre-commit, the exit code is 1 (the cause is unknown)
|
||||
if cfg!(feature = "pre-commit") {
|
||||
expect_end_with("examples/helloworld.er", 1)
|
||||
} else {
|
||||
expect_success("examples/helloworld.er", 0)
|
||||
}
|
||||
expect_success("examples/helloworld.er", 0)
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue