Improved travis check and reformat with cargo fmt (#43)

This commit is contained in:
Armin Ronacher
2019-07-14 21:11:05 +02:00
committed by GitHub
parent 7b6d2d13e9
commit e5fb0d98b5
5 changed files with 317 additions and 276 deletions
+11
View File
@@ -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
+30
View File
@@ -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
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -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
View File
@@ -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");
}
}