✅ test: add tables test
parent
9d29aeb43b
commit
1d813b0f44
36
src/tests.rs
36
src/tests.rs
|
@ -243,6 +243,38 @@ fn is_93 () {
|
||||||
assert_eq! (run (&["", "94"], &chunk), vec! [Value::from (1)]);
|
assert_eq! (run (&["", "94"], &chunk), vec! [Value::from (1)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tables_1 () {
|
||||||
|
// I don't capture stdout yet, but I can at least make sure basic table
|
||||||
|
// operations don't crash
|
||||||
|
|
||||||
|
let src = r#"
|
||||||
|
print " 1"
|
||||||
|
|
||||||
|
print (nil)
|
||||||
|
print (false)
|
||||||
|
print (true)
|
||||||
|
print (1993)
|
||||||
|
print (1993.00)
|
||||||
|
print "Hello."
|
||||||
|
|
||||||
|
print " 2"
|
||||||
|
|
||||||
|
local t = {}
|
||||||
|
print (t)
|
||||||
|
print (t [1])
|
||||||
|
t [1] = "asdf"
|
||||||
|
print (t [1])
|
||||||
|
t.x = 1993
|
||||||
|
print (t.x)
|
||||||
|
|
||||||
|
t.t = { 3.14159 }
|
||||||
|
print (t ["t"][1])
|
||||||
|
"#;
|
||||||
|
|
||||||
|
run_source (&[], src);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn value_size () {
|
fn value_size () {
|
||||||
// Per https://www.lua.org/doc/jucs05.pdf,
|
// Per https://www.lua.org/doc/jucs05.pdf,
|
||||||
|
@ -254,9 +286,7 @@ fn value_size () {
|
||||||
// It would be nice if LunarWaveVM is the same or better.
|
// It would be nice if LunarWaveVM is the same or better.
|
||||||
// There are some exploratory things in this test, too
|
// There are some exploratory things in this test, too
|
||||||
|
|
||||||
use std::{
|
use std::mem::size_of;
|
||||||
mem::size_of,
|
|
||||||
};
|
|
||||||
|
|
||||||
assert! (size_of::<Box <()>> () <= 8);
|
assert! (size_of::<Box <()>> () <= 8);
|
||||||
assert! (size_of::<std::rc::Rc <()>> () <= 8);
|
assert! (size_of::<std::rc::Rc <()>> () <= 8);
|
||||||
|
|
Loading…
Reference in New Issue