From d7962e02be1c4ed5845789479475340284876398 Mon Sep 17 00:00:00 2001 From: connorskees Date: Sat, 7 Jan 2023 17:08:42 +0000 Subject: [PATCH] fix include_sass test --- grass_internal/src/common.rs | 6 ++---- grass_internal/src/lib.rs | 10 ++++------ grass_internal/src/options.rs | 5 ++--- tests/include_sass.rs | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/grass_internal/src/common.rs b/grass_internal/src/common.rs index a033397..c137eb1 100644 --- a/grass_internal/src/common.rs +++ b/grass_internal/src/common.rs @@ -124,11 +124,9 @@ impl ListSeparator { } } -/// In Sass, underscores and hyphens are considered equal -/// when inside identifiers. +/// In Sass, underscores and hyphens are considered equal when inside identifiers. /// -/// This struct protects that invariant by normalizing all -/// underscores into hypens. +/// This struct protects that invariant by normalizing all underscores into hypens. #[derive(Clone, Eq, PartialEq, Hash, PartialOrd, Ord, Copy)] pub(crate) struct Identifier(InternedString); diff --git a/grass_internal/src/lib.rs b/grass_internal/src/lib.rs index e1e9c28..a420266 100644 --- a/grass_internal/src/lib.rs +++ b/grass_internal/src/lib.rs @@ -183,15 +183,14 @@ fn from_string_with_file_name>( /// Compile CSS from a path /// -/// n.b. grass does not currently support files or paths that are not valid UTF-8 +/// n.b. `grass` does not currently support files or paths that are not valid UTF-8 /// /// ``` /// fn main() -> Result<(), Box> { -/// let sass = grass::from_path("input.scss", &grass::Options::default())?; +/// let css = grass::from_path("input.scss", &grass::Options::default())?; /// Ok(()) /// } /// ``` - #[inline] pub fn from_path>(p: P, options: &Options) -> Result { from_string_with_file_name(String::from_utf8(options.fs.read(p.as_ref())?)?, p, options) @@ -201,12 +200,11 @@ pub fn from_path>(p: P, options: &Options) -> Result { /// /// ``` /// fn main() -> Result<(), Box> { -/// let sass = grass::from_string("a { b { color: &; } }".to_string(), &grass::Options::default())?; -/// assert_eq!(sass, "a b {\n color: a b;\n}\n"); +/// let css = grass::from_string("a { b { color: &; } }".to_string(), &grass::Options::default())?; +/// assert_eq!(css, "a b {\n color: a b;\n}\n"); /// Ok(()) /// } /// ``` - #[inline] pub fn from_string(input: String, options: &Options) -> Result { from_string_with_file_name(input, "stdin", options) diff --git a/grass_internal/src/options.rs b/grass_internal/src/options.rs index 0ce0348..834535c 100644 --- a/grass_internal/src/options.rs +++ b/grass_internal/src/options.rs @@ -4,9 +4,8 @@ use crate::{Fs, StdFs}; /// Configuration for Sass compilation /// -/// The simplest usage is `grass::Options::default()`; -/// however, a builder pattern is also exposed to offer -/// more control. +/// The simplest usage is `grass::Options::default()`; however, a builder pattern +/// is also exposed to offer more control. #[derive(Debug)] pub struct Options<'a> { pub(crate) fs: &'a dyn Fs, diff --git a/tests/include_sass.rs b/tests/include_sass.rs index b3b72cf..03e3f56 100644 --- a/tests/include_sass.rs +++ b/tests/include_sass.rs @@ -3,5 +3,5 @@ fn basic() { let css: &str = grass::include!("./input.scss"); - assert!(css == "a {\n color: red;\n}\n"); + assert_eq!(css, "a{color:red}"); }