mirror of
https://github.com/encounter/msvc-demangler-rust.git
synced 2026-07-10 12:18:38 -07:00
Improved travis check and reformat with cargo fmt (#43)
This commit is contained in:
+11
@@ -1,3 +1,14 @@
|
||||
language: rust
|
||||
rust:
|
||||
- stable
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: "check"
|
||||
script: make check
|
||||
|
||||
- name: "lint"
|
||||
script: make lint
|
||||
|
||||
- name: "test"
|
||||
script: make test
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
all: check test
|
||||
.PHONY: all
|
||||
|
||||
check-source:
|
||||
@cargo check
|
||||
.PHONY: check-source
|
||||
|
||||
check-format:
|
||||
@rustup component add rustfmt --toolchain stable 2> /dev/null
|
||||
@cargo +stable fmt -- --check
|
||||
.PHONY: check-format
|
||||
|
||||
check: check-source check-format
|
||||
.PHONY: check
|
||||
|
||||
test-cargo:
|
||||
@cargo test
|
||||
.PHONY: test-cargo
|
||||
|
||||
test-wasm-build:
|
||||
@rustup target add wasm32-unknown-unknown --toolchain stable 2> /dev/null
|
||||
@cargo build --target=wasm32-unknown-unknown
|
||||
.PHONY: test-cargo
|
||||
|
||||
test: test-cargo test-wasm-build
|
||||
.PHONY: test
|
||||
|
||||
lint:
|
||||
@rustup component add clippy --toolchain stable 2> /dev/null
|
||||
@cargo +stable clippy --all --tests -- -D clippy::all
|
||||
+242
-243
File diff suppressed because it is too large
Load Diff
@@ -819,6 +819,6 @@ fn upstream_tests() {
|
||||
);
|
||||
expect(
|
||||
"??__FFLASH_TEMP_FILENAME@sandboxing@mozilla@@YAXXZ",
|
||||
"void __cdecl mozilla::sandboxing::FLASH_TEMP_FILENAME::`dynamic atexit destructor'(void)"
|
||||
"void __cdecl mozilla::sandboxing::FLASH_TEMP_FILENAME::`dynamic atexit destructor'(void)",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+32
-31
@@ -1,7 +1,7 @@
|
||||
extern crate msvc_demangler;
|
||||
|
||||
use std::iter;
|
||||
use msvc_demangler::{parse, serialize, DemangleFlags};
|
||||
use std::iter;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct TestCase<'a> {
|
||||
@@ -17,7 +17,7 @@ enum LineRule<'a> {
|
||||
CheckNotInvalid,
|
||||
}
|
||||
|
||||
fn parse_cases<'a, I: Iterator<Item=&'a str>>(i: I) -> impl Iterator<Item=TestCase<'a>> {
|
||||
fn parse_cases<'a, I: Iterator<Item = &'a str>>(i: I) -> impl Iterator<Item = TestCase<'a>> {
|
||||
let mut rule_iter = i.filter_map(|item| {
|
||||
let item = item.trim();
|
||||
if item.is_empty() {
|
||||
@@ -39,35 +39,33 @@ fn parse_cases<'a, I: Iterator<Item=&'a str>>(i: I) -> impl Iterator<Item=TestCa
|
||||
});
|
||||
|
||||
let mut not_invalid = false;
|
||||
iter::from_fn(move || {
|
||||
loop {
|
||||
match rule_iter.next() {
|
||||
None => return None,
|
||||
Some(LineRule::CheckNotInvalid) => {
|
||||
not_invalid = true;
|
||||
}
|
||||
Some(LineRule::Input(input)) => {
|
||||
while let Some(next) = rule_iter.next() {
|
||||
match next {
|
||||
LineRule::CheckNotInvalid => {
|
||||
panic!("not invalid at unexpected position");
|
||||
}
|
||||
LineRule::Check(check) => {
|
||||
return Some(TestCase {
|
||||
mangled: input,
|
||||
demangled_ref: check,
|
||||
not_invalid,
|
||||
});
|
||||
}
|
||||
LineRule::Input(_) => {
|
||||
panic!("multi line input unsupported");
|
||||
}
|
||||
iter::from_fn(move || loop {
|
||||
match rule_iter.next() {
|
||||
None => return None,
|
||||
Some(LineRule::CheckNotInvalid) => {
|
||||
not_invalid = true;
|
||||
}
|
||||
Some(LineRule::Input(input)) => {
|
||||
while let Some(next) = rule_iter.next() {
|
||||
match next {
|
||||
LineRule::CheckNotInvalid => {
|
||||
panic!("not invalid at unexpected position");
|
||||
}
|
||||
LineRule::Check(check) => {
|
||||
return Some(TestCase {
|
||||
mangled: input,
|
||||
demangled_ref: check,
|
||||
not_invalid,
|
||||
});
|
||||
}
|
||||
LineRule::Input(_) => {
|
||||
panic!("multi line input unsupported");
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(LineRule::Check(check)) => {
|
||||
panic!("unexpected check: {}", check);
|
||||
}
|
||||
}
|
||||
Some(LineRule::Check(check)) => {
|
||||
panic!("unexpected check: {}", check);
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -88,13 +86,16 @@ macro_rules! llvm_test {
|
||||
.replace("constructor", "ctor")
|
||||
.replace("destructor", "dtor")
|
||||
.replace("::`RTTI", " `RTTI");
|
||||
assert!(demangled_fuzzy.contains(case.demangled_ref) || demangled.contains(case.demangled_ref));
|
||||
assert!(
|
||||
demangled_fuzzy.contains(case.demangled_ref)
|
||||
|| demangled.contains(case.demangled_ref)
|
||||
);
|
||||
} else {
|
||||
panic!("not implemented");
|
||||
}
|
||||
println!();
|
||||
}
|
||||
}}
|
||||
}};
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -105,4 +106,4 @@ fn test_llvm_ms_basic() {
|
||||
#[test]
|
||||
fn test_llvm_ms_operators() {
|
||||
llvm_test!("llvm-cases/ms-operators.test");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user