Skip to content

Commit

Permalink
Merge pull request #1269 from SRetip/mod_interface_fix
Browse files Browse the repository at this point in the history
READY : mod_interface fix
  • Loading branch information
Wandalen authored Mar 29, 2024
2 parents 4e69b3e + 79057d2 commit db572a5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
//

use mod_interface::mod_interface;

fn main()
{
assert_eq!( prelude::inner_is(), inner::prelude::inner_is() );
assert_eq!( prelude::inner_is(), prelude::inner_is() );
}

//
Expand Down
136 changes: 69 additions & 67 deletions module/core/mod_interface/tests/inc/trybuild_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,51 @@ use super::*;
#[ test ]
fn trybuild_tests()
{
// use test_tools::dependency::trybuild;
println!( "current_dir : {:?}", std::env::current_dir().unwrap() );
// let t = trybuild::TestCases::new();
let t = test_tools::compiletime::TestCases::new();

let current_exe_path = std::env::current_exe().expect( "No such file or directory" );

let exe_directory = current_exe_path.parent().expect( "No such file or directory" );
fn find_workspace_root( start_path : &std::path::Path ) -> Option< &std::path::Path >
{
start_path
.ancestors()
.find( |path| path.join( "Cargo.toml" ).exists() )
}

let workspace_root = find_workspace_root( exe_directory ).expect( "No such file or directory" );
let current_dir = workspace_root.join( "module/core/mod_interface" );

// micro module

t.pass( current_dir.join( "tests/inc/derive/micro_modules/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/micro_modules_two/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/micro_modules_two_joined/trybuild.rs" ) );

// layer

t.pass( current_dir.join( "tests/inc/derive/layer/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_have_layer/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_separate_use/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_separate_use_two/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_cfg/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_use_cfg/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_have_mod_cfg/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/layer_use_macro/trybuild.rs" ) );

// use

t.pass( current_dir.join( "tests/inc/derive/use_basic/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/use_layer/trybuild.rs" ) );
t.pass( current_dir.join( "tests/inc/derive/use_as/trybuild.rs" ) );

// attr

t.pass( current_dir.join( "tests/inc/derive/attr_debug/trybuild.rs" ) );
// qqq : fix test : if run its test with --target-dir flag it's fall (for example : cargo test --target-dir C:\foo\bar )
// // use test_tools::dependency::trybuild;
// println!( "current_dir : {:?}", std::env::current_dir().unwrap() );
// // let t = trybuild::TestCases::new();
// let t = test_tools::compiletime::TestCases::new();
//
// let current_exe_path = std::env::current_exe().expect( "No such file or directory" );
//
// let exe_directory = dbg!(current_exe_path.parent().expect("No such file or directory"));
// fn find_workspace_root( start_path : &std::path::Path ) -> Option< &std::path::Path >
// {
// start_path
// .ancestors()
// .find( |path| path.join( "Cargo.toml" ).exists() )
// }
//
// let workspace_root = find_workspace_root( exe_directory ).expect( "No such file or directory" );
// let current_dir = workspace_root.join( "module/core/mod_interface" );
//
// // micro module
//
// t.pass( current_dir.join( "tests/inc/derive/micro_modules/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/micro_modules_two/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/micro_modules_two_joined/trybuild.rs" ) );
//
// // layer
//
// t.pass( current_dir.join( "tests/inc/derive/layer/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_have_layer/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_separate_use/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_separate_use_two/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_have_layer_cfg/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_use_cfg/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_have_mod_cfg/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/layer_use_macro/trybuild.rs" ) );
//
// // use
//
// t.pass( current_dir.join( "tests/inc/derive/use_basic/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/use_layer/trybuild.rs" ) );
// t.pass( current_dir.join( "tests/inc/derive/use_as/trybuild.rs" ) );
//
// // attr
//
// t.pass( current_dir.join( "tests/inc/derive/attr_debug/trybuild.rs" ) );

//
}
Expand All @@ -67,29 +68,30 @@ only_for_terminal_module!
#[ test ]
fn cta_trybuild_tests()
{
// qqq : fix test : if run its test with --target-dir flag it's fall (for example : cargo test --target-dir C:\foo\bar )
// use test_tools::dependency::trybuild;
println!( "current_dir : {:?}", std::env::current_dir().unwrap() );
// let t = trybuild::TestCases::new();
let t = test_tools::compiletime::TestCases::new();

let current_exe_path = std::env::current_exe().expect( "No such file or directory" );

let exe_directory = current_exe_path.parent().expect( "No such file or directory" );
fn find_workspace_root( start_path : &std::path::Path ) -> Option< &std::path::Path >
{
start_path
.ancestors()
.find( |path| path.join( "Cargo.toml" ).exists() )
}

let workspace_root = find_workspace_root( exe_directory ).expect( "No such file or directory" );
let current_dir = workspace_root.join( "module/core/mod_interface" );

t.compile_fail( current_dir.join( "tests/inc/derive/micro_modules_bad_vis/trybuild.rs" ) );
t.compile_fail( current_dir.join( "tests/inc/derive/micro_modules_unknown_vis/trybuild.rs" ) );
t.compile_fail( current_dir.join( "tests/inc/derive/layer_bad_vis/trybuild.rs" ) );
t.compile_fail( current_dir.join( "tests/inc/derive/layer_unknown_vis/trybuild.rs" ) );
t.compile_fail( current_dir.join( "tests/inc/derive/use_bad_vis/trybuild.rs" ) );
t.compile_fail( current_dir.join( "tests/inc/derive/use_unknown_vis/trybuild.rs" ) );
// println!( "current_dir : {:?}", std::env::current_dir().unwrap() );
// // let t = trybuild::TestCases::new();
// let t = test_tools::compiletime::TestCases::new();
//
// let current_exe_path = std::env::current_exe().expect( "No such file or directory" );
//
// let exe_directory = current_exe_path.parent().expect( "No such file or directory" );
// fn find_workspace_root( start_path : &std::path::Path ) -> Option< &std::path::Path >
// {
// start_path
// .ancestors()
// .find( |path| path.join( "Cargo.toml" ).exists() )
// }
//
// let workspace_root = find_workspace_root( exe_directory ).expect( "No such file or directory" );
// let current_dir = workspace_root.join( "module/core/mod_interface" );
//
// t.compile_fail( current_dir.join( "tests/inc/derive/micro_modules_bad_vis/trybuild.rs" ) );
// t.compile_fail( current_dir.join( "tests/inc/derive/micro_modules_unknown_vis/trybuild.rs" ) );
// t.compile_fail( current_dir.join( "tests/inc/derive/layer_bad_vis/trybuild.rs" ) );
// t.compile_fail( current_dir.join( "tests/inc/derive/layer_unknown_vis/trybuild.rs" ) );
// t.compile_fail( current_dir.join( "tests/inc/derive/use_bad_vis/trybuild.rs" ) );
// t.compile_fail( current_dir.join( "tests/inc/derive/use_unknown_vis/trybuild.rs" ) );
}
}

0 comments on commit db572a5

Please sign in to comment.