Skip to content

Commit

Permalink
tests: add nightly channel check to emitter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright committed Nov 13, 2019
1 parent 849e818 commit 972a2a7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/syntux/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::cell::RefCell;
use std::path::Path;
use std::rc::Rc;

use rustc_data_structures::sync;
use rustc_data_structures::sync::Send;
use syntax::ast;
use syntax::errors::emitter::{ColorConfig, Emitter, EmitterWriter};
use syntax::errors::{Diagnostic, Handler, Level as DiagnosticLevel};
Expand Down Expand Up @@ -31,15 +31,15 @@ impl Emitter for SilentEmitter {
fn emit_diagnostic(&mut self, _db: &Diagnostic) {}
}

fn silent_emitter() -> Box<dyn Emitter + sync::Send> {
fn silent_emitter() -> Box<dyn Emitter + Send> {
Box::new(SilentEmitter {})
}

/// Emit errors against every files expect ones specified in the `ignore_path_set`.
struct SilentOnIgnoredFilesEmitter {
ignore_path_set: Rc<IgnorePathSet>,
source_map: Rc<SourceMap>,
emitter: Box<dyn Emitter + sync::Send>,
emitter: Box<dyn Emitter + Send>,
has_non_ignorable_parser_errors: bool,
can_reset: Rc<RefCell<bool>>,
}
Expand Down Expand Up @@ -269,6 +269,7 @@ mod tests {
mod emitter {
use super::*;
use crate::config::IgnoreList;
use crate::is_nightly_channel;
use crate::utils::mk_sp;
use std::path::PathBuf;
use syntax::source_map::FileName as SourceMapFileName;
Expand Down Expand Up @@ -347,6 +348,9 @@ mod tests {

#[test]
fn handles_recoverable_parse_error_in_ignored_file() {
if !is_nightly_channel!() {
return;
}
let num_emitted_errors = Rc::new(RefCell::new(0));
let can_reset_errors = Rc::new(RefCell::new(false));
let ignore_list = get_ignore_list(r#"ignore = ["foo.rs"]"#);
Expand All @@ -368,6 +372,9 @@ mod tests {

#[test]
fn handles_recoverable_parse_error_in_non_ignored_file() {
if !is_nightly_channel!() {
return;
}
let num_emitted_errors = Rc::new(RefCell::new(0));
let can_reset_errors = Rc::new(RefCell::new(false));
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
Expand All @@ -388,6 +395,9 @@ mod tests {

#[test]
fn handles_mix_of_recoverable_parse_error() {
if !is_nightly_channel!() {
return;
}
let num_emitted_errors = Rc::new(RefCell::new(0));
let can_reset_errors = Rc::new(RefCell::new(false));
let source_map = Rc::new(SourceMap::new(FilePathMapping::empty()));
Expand Down

0 comments on commit 972a2a7

Please sign in to comment.