Skip to content

Commit 4e29ca2

Browse files
committed
Add additional loggng during tests
1 parent d550825 commit 4e29ca2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

tests/Test/Program.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
using System;
22
using System.Runtime.InteropServices;
3+
using System.Runtime.CompilerServices;
34

45
namespace Test {
56
public static class Program {
7+
[ModuleInitializer]
8+
internal static void Init() {
9+
Console.WriteLine("C# Module Loaded");
10+
Console.WriteLine($"Running under .NET {Environment.Version}");
11+
}
12+
613
public static int Hello(IntPtr arg, int argLength) {
714
Console.WriteLine("Hello from C#!");
815
return 42;

tests/common.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,32 @@ pub fn library_dll_path() -> PdCString {
9191
.unwrap()
9292
}
9393

94+
pub fn display_framework_id(id: &str) -> String {
95+
let s = id.trim_start_matches('.');
96+
97+
if let Some(rest) = s.strip_prefix("netcoreapp") {
98+
// .netcoreappX.Y → .NET Core X.Y
99+
let version = rest.trim_start_matches('.');
100+
return format!(".NET Core {}", version);
101+
}
102+
103+
if let Some(rest) = s.strip_prefix("net") {
104+
// .netX.Y → .NET X.Y
105+
let version = rest.trim_start_matches('.');
106+
return format!(".NET {}", version);
107+
}
108+
109+
// Fallback
110+
id.to_string()
111+
}
112+
94113
pub fn setup() {
114+
println!("Running Test Setup");
115+
println!("Using {}", display_framework_id(&test_netcore_version()));
116+
117+
println!("Building Test Project");
95118
build_test_project();
119+
println!("Building Library Project");
96120
build_library_project();
97121
}
98122

0 commit comments

Comments
 (0)