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