Skip to content

Commit

Permalink
fix/test: refactor caused test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
drahnr committed Oct 10, 2023
1 parent 769451e commit f0c2360
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc-chunks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// contains test helpers
pub mod span;
pub mod tests;
pub mod testcase;
pub use self::span::Span;
pub use proc_macro2::LineColumn;

Expand Down
2 changes: 1 addition & 1 deletion doc-chunks/src/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ impl<'a> fmt::Display for TrimmedLiteralDisplay<'a> {
#[cfg(test)]
mod tests {
use super::*;
use crate::tests::annotated_literals_raw;
use crate::testcase::annotated_literals_raw;
use assert_matches::assert_matches;

#[test]
Expand Down
18 changes: 10 additions & 8 deletions doc-chunks/src/literalset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ macro_rules! chyrp_dbg {
/// Example:
///
/// ```rust
/// let x = chryp_up!(["some", "thing"])
/// # use doc_chunks::chyrp_up;
/// let x = chyrp_up!(["some", "thing"]);
/// let y = r##"#[doc=r#"some
/// thing"#
/// thing"#]
/// struct ChyrpChyrp;"##;
///
/// assert_eq!(x,y);
Expand All @@ -172,10 +173,11 @@ macro_rules! chyrp_up {
/// Example:
///
/// ```rust
/// let x = fluff_up!(["some", "thing"])
/// # use doc_chunks::fluff_up;
/// let x = fluff_up!(["some", "thing"]);
/// let y = r#"/// some
/// /// thing
/// struct Fluff;"##;
/// struct Fluff;"#;
///
/// assert_eq!(x,y);
/// ```
Expand All @@ -192,9 +194,9 @@ macro_rules! fluff_up {
};
}

pub mod tests {
pub mod testhelper {
use super::*;
use crate::tests::annotated_literals;
use crate::testcase::annotated_literals;

pub fn gen_literal_set(source: &str) -> LiteralSet {
let literals = dbg!(annotated_literals(dbg!(source)));
Expand All @@ -213,10 +215,10 @@ pub mod tests {
}

#[cfg(test)]
pub(crate) mod tests {
mod tests {
use super::*;

use crate::tests::annotated_literals;
use super::testhelper::gen_literal_set;
use crate::util::load_span_from;
use crate::util::sub_chars;

Expand Down
3 changes: 2 additions & 1 deletion doc-chunks/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ fn extract_sub_range_from_span(
#[cfg(test)]
mod tests {
use super::*;
use crate::literalset::tests::gen_literal_set;

use crate::literalset::testhelper::gen_literal_set;
use crate::util::load_span_from;
use crate::{chyrp_dbg, chyrp_up, fluff_up};
use crate::{LineColumn, Range, Span};
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/checker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ pub mod dummy;
pub mod tests {
use super::*;
use crate::load_span_from;
use crate::span::Span;
use crate::ContentOrigin;
use crate::Documentation;
use crate::LineColumn;
use crate::Range;
use crate::Span;
use std::path::PathBuf;

use crate::fluff_up;
Expand Down
7 changes: 4 additions & 3 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use super::literalset::tests::gen_literal_set;
use super::*;
use crate::checker::Checker;
use crate::util::{load_span_from, sub_char_range, sub_chars};
use crate::{chyrp_up, fluff_up};
use doc_chunks::literalset::testhelper::gen_literal_set;

use crate::documentation::{tests::annotated_literals, SourceRange};
use crate::documentation::{testcase::annotated_literals, SourceRange};
use indexmap::IndexMap;
use std::convert::From;

#[test]
fn parse_and_construct() {
let _ = env_logger::builder()
Expand Down Expand Up @@ -295,7 +296,7 @@ struct CAPI;
end2end_file_rust!("demo/src/nested/justtwo.rs", 2);
}

// use crate::literalset::tests::{annotated_literals,gen_literal_set};
// use crate::literalset::testhelper::{annotated_literals,gen_literal_set};
use crate::checker::dummy::DummyChecker;
use crate::documentation::Documentation;

Expand Down

0 comments on commit f0c2360

Please sign in to comment.