mirror of
https://github.com/lifegpc/msg-tool.git
synced 2026-06-07 13:28:47 +08:00
check features script now also run cargo test
This commit is contained in:
@@ -38,6 +38,7 @@ def main():
|
||||
sys.exit(0)
|
||||
|
||||
failed_features = []
|
||||
test_failed_features = []
|
||||
|
||||
print(f"Testing {len(feature_names)} features...")
|
||||
for idx, feature in enumerate(feature_names, 1):
|
||||
@@ -50,11 +51,25 @@ def main():
|
||||
print(f"❌ Feature '{feature}' failed to compile")
|
||||
else:
|
||||
print(f"✅ Feature '{feature}' compiled successfully")
|
||||
|
||||
cmd = ["cargo", "test", "--no-default-features", "--features", feature, '--target-dir', 'target/features_check']
|
||||
try:
|
||||
subprocess.run(cmd, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
test_failed_features.append(feature)
|
||||
print(f"❌ Tests for feature '{feature}' failed")
|
||||
else:
|
||||
print(f"✅ Tests for feature '{feature}' passed")
|
||||
|
||||
if failed_features:
|
||||
print("\nFailed features:")
|
||||
for f in failed_features:
|
||||
print(f" - {f}")
|
||||
if failed_features or test_failed_features:
|
||||
if failed_features:
|
||||
print("\nFailed features:")
|
||||
for f in failed_features:
|
||||
print(f" - {f}")
|
||||
if test_failed_features:
|
||||
print("\nFailed tests for features:")
|
||||
for f in test_failed_features:
|
||||
print(f" - {f}")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("\nAll features compiled successfully!")
|
||||
|
||||
@@ -114,19 +114,22 @@ fn test_format() {
|
||||
fommater2.format("● Th\n is is a te st."),
|
||||
"● Th\nis is a te\nst."
|
||||
);
|
||||
let circus_formatter = FixedFormatter::new(10, false, Some(ScriptType::Circus));
|
||||
assert_eq!(
|
||||
circus_formatter.format("● @cmd1@cmd2@cmd3中文字数是一\n 二三 四五六七八九十"),
|
||||
"● @cmd1@cmd2@cmd3中文字数是一二三\n四五六七八九十"
|
||||
);
|
||||
assert_eq!(
|
||||
circus_formatter
|
||||
.format("● @cmd1@cmd2@cmd3{rubyText/中文}字数是一\n 二三 四五六七八九十"),
|
||||
"● @cmd1@cmd2@cmd3{rubyText/中文}字数是一二三\n四五六七八九十"
|
||||
);
|
||||
let circus_formatter2 = FixedFormatter::new(32, false, Some(ScriptType::Circus));
|
||||
assert_eq!(
|
||||
circus_formatter2.format("@re1@re2@b1@t30@w1「当然现在我很幸福哦?\n 因为有你在身边」@n\n「@b1@t38@w1当然现在我很幸福哦?\n 因为有敦也君在身边」"),
|
||||
"@re1@re2@b1@t30@w1「当然现在我很幸福哦?因为有你在身边」@n\n「@b1@t38@w1当然现在我很幸福哦?因为有敦也君在身边」"
|
||||
);
|
||||
#[cfg(feature = "circus")]
|
||||
{
|
||||
let circus_formatter = FixedFormatter::new(10, false, Some(ScriptType::Circus));
|
||||
assert_eq!(
|
||||
circus_formatter.format("● @cmd1@cmd2@cmd3中文字数是一\n 二三 四五六七八九十"),
|
||||
"● @cmd1@cmd2@cmd3中文字数是一二三\n四五六七八九十"
|
||||
);
|
||||
assert_eq!(
|
||||
circus_formatter
|
||||
.format("● @cmd1@cmd2@cmd3{rubyText/中文}字数是一\n 二三 四五六七八九十"),
|
||||
"● @cmd1@cmd2@cmd3{rubyText/中文}字数是一二三\n四五六七八九十"
|
||||
);
|
||||
let circus_formatter2 = FixedFormatter::new(32, false, Some(ScriptType::Circus));
|
||||
assert_eq!(
|
||||
circus_formatter2.format("@re1@re2@b1@t30@w1「当然现在我很幸福哦?\n 因为有你在身边」@n\n「@b1@t38@w1当然现在我很幸福哦?\n 因为有敦也君在身边」"),
|
||||
"@re1@re2@b1@t30@w1「当然现在我很幸福哦?因为有你在身边」@n\n「@b1@t38@w1当然现在我很幸福哦?因为有敦也君在身边」"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user