From 40a875ab7a65f21adae81414de48706b2b794687 Mon Sep 17 00:00:00 2001 From: GrayJack Date: Mon, 26 Oct 2020 15:28:56 -0300 Subject: Add test to avoid regression --- .../test_data/highlighting.html | 312 +++++++++++---------- crates/ide/src/syntax_highlighting/tests.rs | 6 + 2 files changed, 165 insertions(+), 153 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index c6b4f5a00..212f04c80 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -1,197 +1,203 @@ -
use inner::{self as inner_mod};
-mod inner {}
-
-// Needed for function consuming vs normal
-pub mod marker {
-    #[lang = "copy"]
-    pub trait Copy {}
-}
-
-pub mod ops {
-    #[lang = "fn_once"]
-    pub trait FnOnce<Args> {}
-
-    #[lang = "fn_mut"]
-    pub trait FnMut<Args>: FnOnce<Args> {}
-
-    #[lang = "fn"]
-    pub trait Fn<Args>: FnMut<Args> {}
-}
-
+    body                { margin: 0; }
+    pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
+
+    .lifetime           { color: #DFAF8F; font-style: italic; }
+    .comment            { color: #7F9F7F; }
+    .documentation      { color: #629755; }
+    .injected           { opacity: 0.65 ; }
+    .struct, .enum      { color: #7CB8BB; }
+    .enum_variant       { color: #BDE0F3; }
+    .string_literal     { color: #CC9393; }
+    .field              { color: #94BFF3; }
+    .function           { color: #93E0E3; }
+    .function.unsafe    { color: #BC8383; }
+    .operator.unsafe    { color: #BC8383; }
+    .parameter          { color: #94BFF3; }
+    .text               { color: #DCDCCC; }
+    .type               { color: #7CB8BB; }
+    .builtin_type       { color: #8CD0D3; }
+    .type_param         { color: #DFAF8F; }
+    .attribute          { color: #94BFF3; }
+    .numeric_literal    { color: #BFEBBF; }
+    .bool_literal       { color: #BFE6EB; }
+    .macro              { color: #94BFF3; }
+    .module             { color: #AFD8AF; }
+    .value_param        { color: #DCDCCC; }
+    .variable           { color: #DCDCCC; }
+    .format_specifier   { color: #CC696B; }
+    .mutable            { text-decoration: underline; }
+    .escape_sequence    { color: #94BFF3; }
+    .keyword            { color: #F0DFAF; font-weight: bold; }
+    .keyword.unsafe     { color: #BC8383; font-weight: bold; }
+    .control            { font-style: italic; }
+
+    .unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
+    
+    
use inner::{self as inner_mod};
+    mod inner {}
+
+    // Needed for function consuming vs normal
+    pub mod marker {
+        #[lang = "copy"]
+        pub trait Copy {}
+    }
 
-struct Foo {
-    pub x: i32,
-    pub y: i32,
-}
+    pub mod ops {
+        #[lang = "fn_once"]
+        pub trait FnOnce<Args> {}
 
-trait Bar {
-    fn bar(&self) -> i32;
-}
+        #[lang = "fn_mut"]
+        pub trait FnMut<Args>: FnOnce<Args> {}
 
-impl Bar for Foo {
-    fn bar(&self) -> i32 {
-        self.x
+        #[lang = "fn"]
+        pub trait Fn<Args>: FnMut<Args> {}
     }
-}
 
-impl Foo {
-    fn baz(mut self, f: Foo) -> i32 {
-        f.baz(self)
+
+    struct Foo {
+        pub x: i32,
+        pub y: i32,
     }
 
-    fn qux(&mut self) {
-        self.x = 0;
+    trait Bar {
+        fn bar(&self) -> i32;
     }
 
-    fn quop(&self) -> i32 {
-        self.x
+    impl Bar for Foo {
+        fn bar(&self) -> i32 {
+            self.x
+        }
     }
-}
 
-#[derive(Copy)]
-struct FooCopy {
-    x: u32,
-}
+    impl Foo {
+        fn baz(mut self, f: Foo) -> i32 {
+            f.baz(self)
+        }
 
-impl FooCopy {
-    fn baz(self, f: FooCopy) -> u32 {
-        f.baz(self)
-    }
+        fn qux(&mut self) {
+            self.x = 0;
+        }
 
-    fn qux(&mut self) {
-        self.x = 0;
+        fn quop(&self) -> i32 {
+            self.x
+        }
     }
 
-    fn quop(&self) -> u32 {
-        self.x
+    #[derive(Copy)]
+    struct FooCopy {
+        x: u32,
     }
-}
 
-static mut STATIC_MUT: i32 = 0;
+    impl FooCopy {
+        fn baz(self, f: FooCopy) -> u32 {
+            f.baz(self)
+        }
 
-fn foo<'a, T>() -> T {
-    foo::<'a, i32>()
-}
+        fn qux(&mut self) {
+            self.x = 0;
+        }
 
-use ops::Fn;
-fn baz<F: Fn() -> ()>(f: F) {
-    f()
-}
+        fn quop(&self) -> u32 {
+            self.x
+        }
+    }
 
-macro_rules! def_fn {
-    ($($tt:tt)*) => {$($tt)*}
-}
+    static mut STATIC_MUT: i32 = 0;
 
-def_fn! {
-    fn bar() -> u32 {
-        100
+    fn foo<'a, T>() -> T {
+        foo::<'a, i32>()
     }
-}
 
-macro_rules! noop {
-    ($expr:expr) => {
-        $expr
+    use ops::Fn;
+    fn baz<F: Fn() -> ()>(f: F) {
+        f()
     }
-}
 
-macro_rules! keyword_frag {
-    ($type:ty) => ($type)
-}
+    fn foobar() -> impl Copy {}
 
-// comment
-fn main() {
-    println!("Hello, {}!", 92);
+    fn foo() {
+        let bar = foobar();
+    }
 
-    let mut vec = Vec::new();
-    if true {
-        let x = 92;
-        vec.push(Foo { x, y: 1 });
+    macro_rules! def_fn {
+        ($($tt:tt)*) => {$($tt)*}
     }
-    unsafe {
-        vec.set_len(0);
-        STATIC_MUT = 1;
+
+    def_fn! {
+        fn bar() -> u32 {
+            100
+        }
     }
 
-    for e in vec {
-        // Do nothing
+    macro_rules! noop {
+        ($expr:expr) => {
+            $expr
+        }
     }
 
-    noop!(noop!(1));
+    macro_rules! keyword_frag {
+        ($type:ty) => ($type)
+    }
 
-    let mut x = 42;
-    let y = &mut x;
-    let z = &y;
+    // comment
+    fn main() {
+        println!("Hello, {}!", 92);
 
-    let Foo { x: z, y } = Foo { x: z, y };
+        let mut vec = Vec::new();
+        if true {
+            let x = 92;
+            vec.push(Foo { x, y: 1 });
+        }
+        unsafe {
+            vec.set_len(0);
+            STATIC_MUT = 1;
+        }
 
-    y;
+        for e in vec {
+            // Do nothing
+        }
 
-    let mut foo = Foo { x, y: x };
-    let foo2 = Foo { x, y: x };
-    foo.quop();
-    foo.qux();
-    foo.baz(foo2);
+        noop!(noop!(1));
 
-    let mut copy = FooCopy { x };
-    copy.quop();
-    copy.qux();
-    copy.baz(copy);
+        let mut x = 42;
+        let y = &mut x;
+        let z = &y;
 
-    let a = |x| x;
-    let bar = Foo::baz;
+        let Foo { x: z, y } = Foo { x: z, y };
 
-    let baz = -42;
-    let baz = -baz;
-}
+        y;
 
-enum Option<T> {
-    Some(T),
-    None,
-}
-use Option::*;
+        let mut foo = Foo { x, y: x };
+        let foo2 = Foo { x, y: x };
+        foo.quop();
+        foo.qux();
+        foo.baz(foo2);
 
-impl<T> Option<T> {
-    fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
-        match other {
-            None => unimplemented!(),
-            Nope => Nope,
-        }
+        let mut copy = FooCopy { x };
+        copy.quop();
+        copy.qux();
+        copy.baz(copy);
+
+        let a = |x| x;
+        let bar = Foo::baz;
+
+        let baz = -42;
+        let baz = -baz;
     }
-}
\ No newline at end of file + + enum Option<T> { + Some(T), + None, + } + use Option::*; + + impl<T> Option<T> { + fn and<U>(self, other: Option<U>) -> Option<(T, U)> { + match other { + None => unimplemented!(), + Nope => Nope, + } + } + }
\ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index dd43f9dd9..5ea712cf5 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -89,6 +89,12 @@ fn baz ()>(f: F) { f() } +fn foobar() -> impl Copy {} + +fn foo() { + let bar = foobar(); +} + macro_rules! def_fn { ($($tt:tt)*) => {$($tt)*} } -- cgit v1.2.3 From ae6376d74cf354a71a83d8c1dcc93589acbce6ea Mon Sep 17 00:00:00 2001 From: GrayJack Date: Mon, 26 Oct 2020 17:23:29 -0300 Subject: Fix test --- .../test_data/highlighting.html | 316 ++++++++++----------- 1 file changed, 158 insertions(+), 158 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/syntax_highlighting/test_data/highlighting.html b/crates/ide/src/syntax_highlighting/test_data/highlighting.html index 212f04c80..ee115972b 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlighting.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlighting.html @@ -1,203 +1,203 @@ -
use inner::{self as inner_mod};
-    mod inner {}
-
-    // Needed for function consuming vs normal
-    pub mod marker {
-        #[lang = "copy"]
-        pub trait Copy {}
-    }
+body                { margin: 0; }
+pre                 { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; }
+
+.lifetime           { color: #DFAF8F; font-style: italic; }
+.comment            { color: #7F9F7F; }
+.documentation      { color: #629755; }
+.injected           { opacity: 0.65 ; }
+.struct, .enum      { color: #7CB8BB; }
+.enum_variant       { color: #BDE0F3; }
+.string_literal     { color: #CC9393; }
+.field              { color: #94BFF3; }
+.function           { color: #93E0E3; }
+.function.unsafe    { color: #BC8383; }
+.operator.unsafe    { color: #BC8383; }
+.parameter          { color: #94BFF3; }
+.text               { color: #DCDCCC; }
+.type               { color: #7CB8BB; }
+.builtin_type       { color: #8CD0D3; }
+.type_param         { color: #DFAF8F; }
+.attribute          { color: #94BFF3; }
+.numeric_literal    { color: #BFEBBF; }
+.bool_literal       { color: #BFE6EB; }
+.macro              { color: #94BFF3; }
+.module             { color: #AFD8AF; }
+.value_param        { color: #DCDCCC; }
+.variable           { color: #DCDCCC; }
+.format_specifier   { color: #CC696B; }
+.mutable            { text-decoration: underline; }
+.escape_sequence    { color: #94BFF3; }
+.keyword            { color: #F0DFAF; font-weight: bold; }
+.keyword.unsafe     { color: #BC8383; font-weight: bold; }
+.control            { font-style: italic; }
 
-    pub mod ops {
-        #[lang = "fn_once"]
-        pub trait FnOnce<Args> {}
+.unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
+
+
use inner::{self as inner_mod};
+mod inner {}
 
-        #[lang = "fn_mut"]
-        pub trait FnMut<Args>: FnOnce<Args> {}
+// Needed for function consuming vs normal
+pub mod marker {
+    #[lang = "copy"]
+    pub trait Copy {}
+}
 
-        #[lang = "fn"]
-        pub trait Fn<Args>: FnMut<Args> {}
-    }
+pub mod ops {
+    #[lang = "fn_once"]
+    pub trait FnOnce<Args> {}
+
+    #[lang = "fn_mut"]
+    pub trait FnMut<Args>: FnOnce<Args> {}
+
+    #[lang = "fn"]
+    pub trait Fn<Args>: FnMut<Args> {}
+}
 
 
-    struct Foo {
-        pub x: i32,
-        pub y: i32,
+struct Foo {
+    pub x: i32,
+    pub y: i32,
+}
+
+trait Bar {
+    fn bar(&self) -> i32;
+}
+
+impl Bar for Foo {
+    fn bar(&self) -> i32 {
+        self.x
     }
+}
 
-    trait Bar {
-        fn bar(&self) -> i32;
+impl Foo {
+    fn baz(mut self, f: Foo) -> i32 {
+        f.baz(self)
     }
 
-    impl Bar for Foo {
-        fn bar(&self) -> i32 {
-            self.x
-        }
+    fn qux(&mut self) {
+        self.x = 0;
     }
 
-    impl Foo {
-        fn baz(mut self, f: Foo) -> i32 {
-            f.baz(self)
-        }
+    fn quop(&self) -> i32 {
+        self.x
+    }
+}
 
-        fn qux(&mut self) {
-            self.x = 0;
-        }
+#[derive(Copy)]
+struct FooCopy {
+    x: u32,
+}
 
-        fn quop(&self) -> i32 {
-            self.x
-        }
+impl FooCopy {
+    fn baz(self, f: FooCopy) -> u32 {
+        f.baz(self)
     }
 
-    #[derive(Copy)]
-    struct FooCopy {
-        x: u32,
+    fn qux(&mut self) {
+        self.x = 0;
     }
 
-    impl FooCopy {
-        fn baz(self, f: FooCopy) -> u32 {
-            f.baz(self)
-        }
+    fn quop(&self) -> u32 {
+        self.x
+    }
+}
 
-        fn qux(&mut self) {
-            self.x = 0;
-        }
+static mut STATIC_MUT: i32 = 0;
 
-        fn quop(&self) -> u32 {
-            self.x
-        }
-    }
+fn foo<'a, T>() -> T {
+    foo::<'a, i32>()
+}
 
-    static mut STATIC_MUT: i32 = 0;
+use ops::Fn;
+fn baz<F: Fn() -> ()>(f: F) {
+    f()
+}
 
-    fn foo<'a, T>() -> T {
-        foo::<'a, i32>()
-    }
+fn foobar() -> impl Copy {}
 
-    use ops::Fn;
-    fn baz<F: Fn() -> ()>(f: F) {
-        f()
-    }
+fn foo() {
+    let bar = foobar();
+}
 
-    fn foobar() -> impl Copy {}
+macro_rules! def_fn {
+    ($($tt:tt)*) => {$($tt)*}
+}
 
-    fn foo() {
-        let bar = foobar();
+def_fn! {
+    fn bar() -> u32 {
+        100
     }
+}
 
-    macro_rules! def_fn {
-        ($($tt:tt)*) => {$($tt)*}
+macro_rules! noop {
+    ($expr:expr) => {
+        $expr
     }
+}
 
-    def_fn! {
-        fn bar() -> u32 {
-            100
-        }
-    }
+macro_rules! keyword_frag {
+    ($type:ty) => ($type)
+}
 
-    macro_rules! noop {
-        ($expr:expr) => {
-            $expr
-        }
-    }
+// comment
+fn main() {
+    println!("Hello, {}!", 92);
 
-    macro_rules! keyword_frag {
-        ($type:ty) => ($type)
+    let mut vec = Vec::new();
+    if true {
+        let x = 92;
+        vec.push(Foo { x, y: 1 });
+    }
+    unsafe {
+        vec.set_len(0);
+        STATIC_MUT = 1;
     }
 
-    // comment
-    fn main() {
-        println!("Hello, {}!", 92);
-
-        let mut vec = Vec::new();
-        if true {
-            let x = 92;
-            vec.push(Foo { x, y: 1 });
-        }
-        unsafe {
-            vec.set_len(0);
-            STATIC_MUT = 1;
-        }
+    for e in vec {
+        // Do nothing
+    }
 
-        for e in vec {
-            // Do nothing
-        }
+    noop!(noop!(1));
 
-        noop!(noop!(1));
+    let mut x = 42;
+    let y = &mut x;
+    let z = &y;
 
-        let mut x = 42;
-        let y = &mut x;
-        let z = &y;
+    let Foo { x: z, y } = Foo { x: z, y };
 
-        let Foo { x: z, y } = Foo { x: z, y };
+    y;
 
-        y;
+    let mut foo = Foo { x, y: x };
+    let foo2 = Foo { x, y: x };
+    foo.quop();
+    foo.qux();
+    foo.baz(foo2);
 
-        let mut foo = Foo { x, y: x };
-        let foo2 = Foo { x, y: x };
-        foo.quop();
-        foo.qux();
-        foo.baz(foo2);
+    let mut copy = FooCopy { x };
+    copy.quop();
+    copy.qux();
+    copy.baz(copy);
 
-        let mut copy = FooCopy { x };
-        copy.quop();
-        copy.qux();
-        copy.baz(copy);
+    let a = |x| x;
+    let bar = Foo::baz;
 
-        let a = |x| x;
-        let bar = Foo::baz;
+    let baz = -42;
+    let baz = -baz;
+}
 
-        let baz = -42;
-        let baz = -baz;
-    }
+enum Option<T> {
+    Some(T),
+    None,
+}
+use Option::*;
 
-    enum Option<T> {
-        Some(T),
-        None,
-    }
-    use Option::*;
-
-    impl<T> Option<T> {
-        fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
-            match other {
-                None => unimplemented!(),
-                Nope => Nope,
-            }
+impl<T> Option<T> {
+    fn and<U>(self, other: Option<U>) -> Option<(T, U)> {
+        match other {
+            None => unimplemented!(),
+            Nope => Nope,
         }
-    }
\ No newline at end of file + } +}
\ No newline at end of file -- cgit v1.2.3