Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sisshiki1969 committed Nov 25, 2024
1 parent b480228 commit f4192da
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ jobs:
- run: |
cargo install grcov cargo-nextest
rustup component add llvm-tools-preview
export RUSTFLAGS="-Cinstrument-coverage"
- name: Install
run: cargo install --all-features --path monoruby
- name: Run tests
run: |
cargo build
LLVM_PROFILE_FILE="monoruby-%p-%m.profraw" cargo test
LLVM_PROFILE_FILE="monoruby-bin-%p-%m.profraw" monoruby test.rb
LLVM_PROFILE_FILE="monoruby-stdin-%p-%m.profraw" monoruby < test.rb
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion monoruby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ perf = []
emit-cfg = ["dump-bc"]
no-gems = []
no-startup = ["no-gems"]
test = ["no-gems", "emit-asm", "emit-bc", "jit-log", "jit-debug", "deopt", "gc-log", "profile", "perf"]
# test = ["no-gems", "emit-asm", "emit-bc", "jit-log", "jit-debug", "deopt", "gc-log", "profile", "perf"]

[dependencies]
clap = { version = "4.5.21", features = ["derive"] }
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1734,8 +1734,9 @@ fn insert(_: &mut Executor, _: &mut Globals, lfp: Lfp) -> Result<Value> {
Ok(lfp.self_val())
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn array_new() {
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ fn local_variables(_: &mut Executor, globals: &mut Globals, lfp: Lfp) -> Result<
Ok(Value::array_from_vec(v))
}

mod test {
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ extern "C" fn check_initializer(globals: &mut Globals, receiver: Value) -> Optio
globals.check_method(receiver, IdentId::INITIALIZE)
}

mod test {
#[cfg(test)]
mod tests {
use super::tests::*;

#[test]
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ fn home(_: &mut Executor, _: &mut Globals, _: Lfp) -> Result<Value> {
Ok(Value::string(home.to_string_lossy().to_string()))
}

mod test {
#[cfg(test)]
mod tests {
use super::tests::*;

#[test]
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,9 @@ extern "C" fn extern_sin(f: f64) -> f64 {
f.sin()
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
#[ignore]
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/numeric/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ fn rect(_: &mut Executor, _: &mut Globals, lfp: Lfp) -> Result<Value> {
Ok(Value::array2(r.get(), i.get()))
}

mod test {
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/numeric/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ fn abs(_vm: &mut Executor, _globals: &mut Globals, lfp: Lfp) -> Result<Value> {
Ok(Value::float(f.abs()))
}

mod test {
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/numeric/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,9 @@ fn zero_(_vm: &mut Executor, _globals: &mut Globals, lfp: Lfp) -> Result<Value>
Ok(Value::bool(b))
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn times() {
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/object/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ fn object_send_inner(
ir.reg2acc(bb, GP::Rax, dst);
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn object_send() {
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ fn clock_gettime(_vm: &mut Executor, globals: &mut Globals, lfp: Lfp) -> Result<
})
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn process() {
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,9 @@ fn toa(_vm: &mut Executor, _globals: &mut Globals, lfp: Lfp) -> Result<Value> {
}
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn range() {
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/regexp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ fn match_(vm: &mut Executor, _globals: &mut Globals, lfp: Lfp) -> Result<Value>
))
}

mod test {
#[cfg(test)]
mod tests {
use crate::tests::*;
#[test]
fn regexp_last_match() {
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2135,8 +2135,9 @@ fn valid_encoding(_: &mut Executor, _: &mut Globals, lfp: Lfp) -> Result<Value>
Ok(Value::bool(lfp.self_val().as_bytes().valid()))
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn string_empty() {
Expand Down
1 change: 1 addition & 0 deletions monoruby/src/builtins/struct_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ fn members(_vm: &mut Executor, globals: &mut Globals, lfp: Lfp) -> Result<Value>
Ok(members)
}

#[cfg(test)]
mod tests {
use crate::tests::*;

Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/builtins/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ fn ne(_: &mut Executor, _: &mut Globals, lfp: Lfp) -> Result<Value> {
}
}

mod test {
#[cfg(test)]
mod tests {
use crate::tests::*;
#[test]
fn symbol_cmp() {
Expand Down
5 changes: 3 additions & 2 deletions monoruby/src/builtins/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ impl TimeInner {
}
}

mod test {
use super::tests::*;
#[cfg(test)]
mod tests {
use crate::tests::*;

#[test]
fn test_time() {
Expand Down
3 changes: 2 additions & 1 deletion monoruby/src/value/rvalue/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ impl HashContent {
}
}

mod test {
#[cfg(test)]
mod tests {
use super::*;

#[test]
Expand Down
File renamed without changes.

0 comments on commit f4192da

Please sign in to comment.