Skip to content

Commit

Permalink
Use triple macro
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Dec 7, 2020
1 parent 249b955 commit 624f0ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/compiler-singlepass/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ lazy_static = "1.4"
byteorder = "1.3"
smallvec = "1.5"

[dev-dependencies]
target-lexicon = { version = "0.11", default-features = false }

[badges]
maintenance = { status = "actively-developed" }

Expand Down
16 changes: 4 additions & 12 deletions lib/compiler-singlepass/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ fn to_compile_error<T: ToCompileError>(x: T) -> CompileError {
mod tests {
use super::*;
use std::str::FromStr;
use target_lexicon::triple;
use wasmer_compiler::{CpuFeature, Features, Triple};
use wasmer_vm::{MemoryStyle, TableStyle};

Expand All @@ -200,10 +201,7 @@ mod tests {
let compiler = SinglepassCompiler::new(Singlepass::default());

// Compile for win64
let win64 = Target::new(
Triple::from_str("x86_64-pc-windows-msvc").unwrap(),
CpuFeature::for_host(),
);
let win64 = Target::new(triple!("x86_64-pc-windows-msvc"), CpuFeature::for_host());
let (mut info, translation, inputs) = dummy_compilation_ingredients();
let result = compiler.compile_module(&win64, &mut info, &translation, inputs);
match result.unwrap_err() {
Expand All @@ -212,10 +210,7 @@ mod tests {
};

// Compile for 32bit Linux
let linux32 = Target::new(
Triple::from_str("i686-unknown-linux-gnu").unwrap(),
CpuFeature::for_host(),
);
let linux32 = Target::new(triple!("i686-unknown-linux-gnu"), CpuFeature::for_host());
let (mut info, translation, inputs) = dummy_compilation_ingredients();
let result = compiler.compile_module(&linux32, &mut info, &translation, inputs);
match result.unwrap_err() {
Expand All @@ -224,10 +219,7 @@ mod tests {
};

// Compile for win32
let win32 = Target::new(
Triple::from_str("i686-pc-windows-gnu").unwrap(),
CpuFeature::for_host(),
);
let win32 = Target::new(triple!("i686-pc-windows-gnu"), CpuFeature::for_host());
let (mut info, translation, inputs) = dummy_compilation_ingredients();
let result = compiler.compile_module(&win32, &mut info, &translation, inputs);
match result.unwrap_err() {
Expand Down

0 comments on commit 624f0ec

Please sign in to comment.