Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace time with std::time #107

Merged
merged 1 commit into from
Mar 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ synom = { version = "0.11", path = "synom", optional = true }
syntex_pos = "0.58"
syntex_syntax = "0.58"
tempdir = "0.3.5"
time = "0.1.35"
walkdir = "1.0.1"
9 changes: 4 additions & 5 deletions tests/test_round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ extern crate quote;
extern crate syn;
extern crate syntex_pos;
extern crate syntex_syntax;
extern crate time;
extern crate walkdir;

use syntex_pos::Span;
use syntex_syntax::ast;
use syntex_syntax::parse::{self, ParseSess, PResult};
use time::PreciseTime;
use walkdir::{DirEntry, WalkDir, WalkDirIterator};

use std::fs::File;
use std::io::{self, Read, Write};
use std::panic;
use std::time::Instant;

macro_rules! errorf {
($($tt:tt)*) => {
Expand Down Expand Up @@ -75,9 +74,9 @@ fn test_round_trip() {
let mut content = String::new();
file.read_to_string(&mut content).unwrap();

let start = PreciseTime::now();
let start = Instant::now();
let (krate, elapsed) = match syn::parse_crate(&content) {
Ok(krate) => (krate, start.to(PreciseTime::now())),
Ok(krate) => (krate, start.elapsed()),
Err(msg) => {
errorf!("syn failed to parse\n{}\n", msg);
failed += 1;
Expand Down Expand Up @@ -111,7 +110,7 @@ fn test_round_trip() {
};

if before == after {
errorf!("pass in {}ms\n", elapsed.num_milliseconds());
errorf!("pass in {}ms\n", (elapsed.as_secs() * 1000) as u64 + elapsed.subsec_nanos() / 1000_000);
true
} else {
errorf!("FAIL\nbefore: {}\nafter: {}\n",
Expand Down