From e534e907e808d1e7667f3983249c12df592053a6 Mon Sep 17 00:00:00 2001 From: Juan Ibiapina Date: Wed, 13 Jun 2018 10:56:29 +0200 Subject: [PATCH] Use default rust directory structure for tests --- src/lib.rs | 3 --- src/tests/mod.rs | 26 ---------------------- {src/tests => tests}/arrays.rs | 8 ++++--- {src/tests => tests}/binary_ops.rs | 4 +++- {src/tests => tests}/bit_shift.rs | 4 +++- {src/tests => tests}/bool_op.rs | 6 +++-- {src/tests => tests}/chars.rs | 6 +++-- {src/tests => tests}/comments.rs | 4 +++- {src/tests => tests}/compound_equality.rs | 6 +++-- {src/tests => tests}/decrement.rs | 4 +++- {src/tests => tests}/float.rs | 6 +++-- {src/tests => tests}/get_set.rs | 6 +++-- {src/tests => tests}/if_block.rs | 4 +++- {src/tests => tests}/increment.rs | 4 +++- {src/tests => tests}/internal_fn.rs | 4 +++- {src/tests => tests}/looping.rs | 4 +++- {src/tests => tests}/method_call.rs | 6 +++-- {src/tests => tests}/mismatched_op.rs | 4 +++- {src/tests => tests}/not.rs | 4 +++- {src/tests => tests}/number_literals.rs | 6 +++-- {src/tests => tests}/ops.rs | 6 +++-- {src/tests => tests}/power_of.rs | 4 +++- {src/tests => tests}/string.rs | 4 +++- {src/tests => tests}/unary_after_binary.rs | 4 +++- {src/tests => tests}/unary_minus.rs | 4 +++- {src/tests => tests}/unit.rs | 6 +++-- {src/tests => tests}/var_scope.rs | 4 +++- {src/tests => tests}/while_loop.rs | 4 +++- 28 files changed, 89 insertions(+), 66 deletions(-) delete mode 100644 src/tests/mod.rs rename {src/tests => tests}/arrays.rs (95%) rename {src/tests => tests}/binary_ops.rs (95%) rename {src/tests => tests}/bit_shift.rs (91%) rename {src/tests => tests}/bool_op.rs (91%) rename {src/tests => tests}/chars.rs (91%) rename {src/tests => tests}/comments.rs (86%) rename {src/tests => tests}/compound_equality.rs (98%) rename {src/tests => tests}/decrement.rs (90%) rename {src/tests => tests}/float.rs (96%) rename {src/tests => tests}/get_set.rs (96%) rename {src/tests => tests}/if_block.rs (92%) rename {src/tests => tests}/increment.rs (91%) rename {src/tests => tests}/internal_fn.rs (94%) rename {src/tests => tests}/looping.rs (86%) rename {src/tests => tests}/method_call.rs (91%) rename {src/tests => tests}/mismatched_op.rs (77%) rename {src/tests => tests}/not.rs (90%) rename {src/tests => tests}/number_literals.rs (96%) rename {src/tests => tests}/ops.rs (93%) rename {src/tests => tests}/power_of.rs (96%) rename {src/tests => tests}/string.rs (91%) rename {src/tests => tests}/unary_after_binary.rs (96%) rename {src/tests => tests}/unary_minus.rs (87%) rename {src/tests => tests}/unit.rs (94%) rename {src/tests => tests}/var_scope.rs (95%) rename {src/tests => tests}/while_loop.rs (88%) diff --git a/src/lib.rs b/src/lib.rs index 14bc19a9..a012216e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,9 +47,6 @@ mod engine; mod fn_register; mod parser; -#[cfg(test)] -mod tests; - pub use any::Any; pub use engine::{Engine, EvalAltResult, Scope}; pub use fn_register::RegisterFn; diff --git a/src/tests/mod.rs b/src/tests/mod.rs deleted file mode 100644 index 080cea67..00000000 --- a/src/tests/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -mod arrays; -mod binary_ops; -mod bit_shift; -mod bool_op; -mod chars; -mod comments; -mod compound_equality; -mod decrement; -mod float; -mod get_set; -mod if_block; -mod increment; -mod internal_fn; -mod looping; -mod method_call; -mod mismatched_op; -mod not; -mod number_literals; -mod ops; -mod power_of; -mod string; -mod unary_after_binary; -mod unary_minus; -mod unit; -mod var_scope; -mod while_loop; \ No newline at end of file diff --git a/src/tests/arrays.rs b/tests/arrays.rs similarity index 95% rename from src/tests/arrays.rs rename to tests/arrays.rs index 07e2cd30..37a4e823 100644 --- a/src/tests/arrays.rs +++ b/tests/arrays.rs @@ -1,5 +1,7 @@ -use engine::Engine; -use fn_register::RegisterFn; +extern crate rhai; + +use rhai::Engine; +use rhai::RegisterFn; #[test] fn test_arrays() { @@ -63,4 +65,4 @@ fn test_array_with_structs() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/binary_ops.rs b/tests/binary_ops.rs similarity index 95% rename from src/tests/binary_ops.rs rename to tests/binary_ops.rs index c927080d..a9cb58e2 100644 --- a/src/tests/binary_ops.rs +++ b/tests/binary_ops.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_binary_ops() { diff --git a/src/tests/bit_shift.rs b/tests/bit_shift.rs similarity index 91% rename from src/tests/bit_shift.rs rename to tests/bit_shift.rs index 09a42aa9..c35de15d 100644 --- a/src/tests/bit_shift.rs +++ b/tests/bit_shift.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_left_shift() { diff --git a/src/tests/bool_op.rs b/tests/bool_op.rs similarity index 91% rename from src/tests/bool_op.rs rename to tests/bool_op.rs index 6b0f6ee8..a9ecf84b 100644 --- a/src/tests/bool_op.rs +++ b/tests/bool_op.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_bool_op1() { @@ -20,4 +22,4 @@ fn test_bool_op2() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/chars.rs b/tests/chars.rs similarity index 91% rename from src/tests/chars.rs rename to tests/chars.rs index 6ac9c7d7..7e0100fe 100644 --- a/src/tests/chars.rs +++ b/tests/chars.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_chars() { @@ -20,4 +22,4 @@ fn test_chars() { Err(_) => (), _ => assert!(false), } -} \ No newline at end of file +} diff --git a/src/tests/comments.rs b/tests/comments.rs similarity index 86% rename from src/tests/comments.rs rename to tests/comments.rs index a2193083..48d25c1b 100644 --- a/src/tests/comments.rs +++ b/tests/comments.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_comments() { diff --git a/src/tests/compound_equality.rs b/tests/compound_equality.rs similarity index 98% rename from src/tests/compound_equality.rs rename to tests/compound_equality.rs index 5314fd6f..dc8cc3ed 100644 --- a/src/tests/compound_equality.rs +++ b/tests/compound_equality.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_or_equals() { @@ -116,4 +118,4 @@ fn test_modulo_equals() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/decrement.rs b/tests/decrement.rs similarity index 90% rename from src/tests/decrement.rs rename to tests/decrement.rs index d73e7e31..87bb8c1f 100644 --- a/src/tests/decrement.rs +++ b/tests/decrement.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_decrement() { diff --git a/src/tests/float.rs b/tests/float.rs similarity index 96% rename from src/tests/float.rs rename to tests/float.rs index 573077ff..eb4003c7 100644 --- a/src/tests/float.rs +++ b/tests/float.rs @@ -1,5 +1,7 @@ -use engine::Engine; -use fn_register::RegisterFn; +extern crate rhai; + +use rhai::Engine; +use rhai::RegisterFn; #[test] fn test_float() { diff --git a/src/tests/get_set.rs b/tests/get_set.rs similarity index 96% rename from src/tests/get_set.rs rename to tests/get_set.rs index 6315ad2c..58076fca 100644 --- a/src/tests/get_set.rs +++ b/tests/get_set.rs @@ -1,5 +1,7 @@ -use engine::Engine; -use fn_register::RegisterFn; +extern crate rhai; + +use rhai::Engine; +use rhai::RegisterFn; #[test] fn test_get_set() { diff --git a/src/tests/if_block.rs b/tests/if_block.rs similarity index 92% rename from src/tests/if_block.rs rename to tests/if_block.rs index 0c766b34..4202940f 100644 --- a/src/tests/if_block.rs +++ b/tests/if_block.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_if() { diff --git a/src/tests/increment.rs b/tests/increment.rs similarity index 91% rename from src/tests/increment.rs rename to tests/increment.rs index e48f9ba7..3dc4593b 100644 --- a/src/tests/increment.rs +++ b/tests/increment.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_increment() { diff --git a/src/tests/internal_fn.rs b/tests/internal_fn.rs similarity index 94% rename from src/tests/internal_fn.rs rename to tests/internal_fn.rs index c0632399..5dcb37f6 100644 --- a/src/tests/internal_fn.rs +++ b/tests/internal_fn.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_internal_fn() { diff --git a/src/tests/looping.rs b/tests/looping.rs similarity index 86% rename from src/tests/looping.rs rename to tests/looping.rs index 391af706..76990dcc 100644 --- a/src/tests/looping.rs +++ b/tests/looping.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_loop() { diff --git a/src/tests/method_call.rs b/tests/method_call.rs similarity index 91% rename from src/tests/method_call.rs rename to tests/method_call.rs index 72ed3064..9208459d 100644 --- a/src/tests/method_call.rs +++ b/tests/method_call.rs @@ -1,5 +1,7 @@ -use engine::Engine; -use fn_register::RegisterFn; +extern crate rhai; + +use rhai::Engine; +use rhai::RegisterFn; #[test] fn test_method_call() { diff --git a/src/tests/mismatched_op.rs b/tests/mismatched_op.rs similarity index 77% rename from src/tests/mismatched_op.rs rename to tests/mismatched_op.rs index a3e04999..b60c1134 100644 --- a/src/tests/mismatched_op.rs +++ b/tests/mismatched_op.rs @@ -1,4 +1,6 @@ -use engine::{Engine, EvalAltResult}; +extern crate rhai; + +use rhai::{Engine, EvalAltResult}; #[test] fn test_mismatched_op() { diff --git a/src/tests/not.rs b/tests/not.rs similarity index 90% rename from src/tests/not.rs rename to tests/not.rs index a58f274d..81c0d217 100644 --- a/src/tests/not.rs +++ b/tests/not.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_not() { diff --git a/src/tests/number_literals.rs b/tests/number_literals.rs similarity index 96% rename from src/tests/number_literals.rs rename to tests/number_literals.rs index d71520c4..7f9a0cbe 100644 --- a/src/tests/number_literals.rs +++ b/tests/number_literals.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_number_literal() { @@ -60,4 +62,4 @@ fn test_binary_literal() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/ops.rs b/tests/ops.rs similarity index 93% rename from src/tests/ops.rs rename to tests/ops.rs index f18e1036..5d30580a 100644 --- a/src/tests/ops.rs +++ b/tests/ops.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_ops() { @@ -26,4 +28,4 @@ fn test_op_prec() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/power_of.rs b/tests/power_of.rs similarity index 96% rename from src/tests/power_of.rs rename to tests/power_of.rs index ed0b7800..14d6a030 100644 --- a/src/tests/power_of.rs +++ b/tests/power_of.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_power_of() { diff --git a/src/tests/string.rs b/tests/string.rs similarity index 91% rename from src/tests/string.rs rename to tests/string.rs index d5d45959..975b7adc 100644 --- a/src/tests/string.rs +++ b/tests/string.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_string() { diff --git a/src/tests/unary_after_binary.rs b/tests/unary_after_binary.rs similarity index 96% rename from src/tests/unary_after_binary.rs rename to tests/unary_after_binary.rs index 8fc6b855..848ff2c3 100644 --- a/src/tests/unary_after_binary.rs +++ b/tests/unary_after_binary.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] // TODO also add test case for unary after compound diff --git a/src/tests/unary_minus.rs b/tests/unary_minus.rs similarity index 87% rename from src/tests/unary_minus.rs rename to tests/unary_minus.rs index 20b05a16..0306067f 100644 --- a/src/tests/unary_minus.rs +++ b/tests/unary_minus.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_unary_minus() { diff --git a/src/tests/unit.rs b/tests/unit.rs similarity index 94% rename from src/tests/unit.rs rename to tests/unit.rs index 1b9c0c36..ad2aff08 100644 --- a/src/tests/unit.rs +++ b/tests/unit.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_unit() { @@ -31,4 +33,4 @@ fn test_unit_with_spaces() { } else { assert!(false); } -} \ No newline at end of file +} diff --git a/src/tests/var_scope.rs b/tests/var_scope.rs similarity index 95% rename from src/tests/var_scope.rs rename to tests/var_scope.rs index 89c6f96d..0243671d 100644 --- a/src/tests/var_scope.rs +++ b/tests/var_scope.rs @@ -1,4 +1,6 @@ -use engine::{Engine, Scope}; +extern crate rhai; + +use rhai::{Engine, Scope}; #[test] fn test_var_scope() { diff --git a/src/tests/while_loop.rs b/tests/while_loop.rs similarity index 88% rename from src/tests/while_loop.rs rename to tests/while_loop.rs index d81b1a64..c34d72d3 100644 --- a/src/tests/while_loop.rs +++ b/tests/while_loop.rs @@ -1,4 +1,6 @@ -use engine::Engine; +extern crate rhai; + +use rhai::Engine; #[test] fn test_while() {