Skip to content

Commit e1ffe21

Browse files
authored
test: remove miette decorations and color during test (#170)
* test: remove miette decorations and color during test * docs: comment * docs: comment
1 parent 3aacc5b commit e1ffe21

File tree

3 files changed

+100
-91
lines changed

3 files changed

+100
-91
lines changed

crates/lintspec/src/textindex.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl TextIndex {
3535
/// This is *not* derived from the definition of 'newline' in the language definition,
3636
/// nor is it a complete implementation of the Unicode line breaking algorithm.
3737
///
38-
/// Implementation is directly taken from [`slang_solidity`].
38+
/// Implementation is inspired from [`slang_solidity`].
3939
#[inline]
4040
pub fn advance(&mut self, c: char, next: Option<&char>) {
4141
// fast path for ASCII characters
@@ -217,6 +217,7 @@ fn find_non_ascii_and_newlines(chunk: &[i8]) -> u16 {
217217
let bytes = i8x16::from_slice_unaligned(chunk);
218218

219219
// find non-ASCII
220+
// u8 values from 128 to 255 correspond to i8 values -128 to -1
220221
let nonascii_mask = bytes.simd_lt(i8x16::ZERO).to_bitmask();
221222
// find newlines
222223
#[allow(clippy::cast_possible_wrap)]

crates/lintspec/tests/snapshots/tests_unicode_sample__unicode.snap

Lines changed: 90 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,93 @@
22
source: crates/lintspec/tests/tests-unicode-sample.rs
33
expression: "snapshot_content(\"./test-data/UnicodeSample.sol\",\n&ValidationOptions::default(), true, false)"
44
---
5-
× error UnicodeSample.BasicSample_SomeError
6-
╭─[./test-data/UnicodeSample.sol:22:41]
7-
21 */
8-
22 error BasicSample_SomeError(uint256 _param1);
9-
· ───┬───
10-
· ╰── @param _param1 is missing
11-
23
12-
╰────
13-
× event UnicodeSample.BasicSample_BasicEvent
14-
╭─[./test-data/UnicodeSample.sol:27:42]
15-
26 */
16-
27 event BasicSample_BasicEvent(uint256 _param1);
17-
· ───┬───
18-
· ╰── @param _param1 is missing
19-
28
20-
╰────
21-
× variable UnicodeSample.somePublicNumber
22-
╭─[./test-data/UnicodeSample.sol:35:5]
23-
34
24-
35 │ ╭─▶ /**
25-
36 │ │ * @notice A public state variable
26-
37 │ │ */
27-
38 │ ├─▶ uint256 public somePublicNumber;
28-
· ╰──── @inheritdoc is missing
29-
39
30-
╰────
31-
× constructor UnicodeSample.constructor
32-
╭─[./test-data/UnicodeSample.sol:40:22]
33-
39
34-
40 constructor(bool _randomFlag) {}
35-
· ─────┬─────
36-
· ╰── @param _randomFlag is missing
37-
41
38-
╰────
39-
× function UnicodeSample.externalSimple
40-
╭─[./test-data/UnicodeSample.sol:42:5]
41-
41
42-
42 │ ╭─▶ /**
43-
43 │ │ * @notice External function that returns a bool
44-
44 │ │ * @dev A dev comment
45-
45 │ │ * @param _magicNumber A parameter description
46-
46 │ │ * @param _name Another parameter description
47-
47 │ │ * @param _name Another parameter description
48-
48 │ │ * @return _isMagic Some return data
49-
49 │ │ */
50-
50 │ │ function externalSimple(uint256 _magicNumber, /* 🦀 */ string memory _name)
51-
51 │ │ external
52-
52 │ │ pure
53-
53 │ ├─▶ returns (bool _isMagic)
54-
· ╰──── @inheritdoc is missing
55-
54 {
56-
╰────
57-
× function UnicodeSample.externalSimpleMultipleReturn
58-
╭─[./test-data/UnicodeSample.sol:64:5]
59-
63
60-
64 │ ╭─▶ /**
61-
65 │ │ * @notice External function that returns a bool
62-
66 │ │ * @dev A dev comment
63-
67 │ │ * @param _magicNumber A parameter description
64-
68 │ │ * @param _name Another parameter description
65-
69 │ │ * @return _isMagic 🔥 Some return data
66-
70 │ │ * @return Test test
67-
71 │ │ */
68-
72 │ │ function externalSimpleMultipleReturn(uint256 _magicNumber, string memory _name)
69-
73 │ │ external
70-
74 │ │ pure
71-
75 │ ├─▶ returns (bool _isMagic, uint256)
72-
· ╰──── @inheritdoc is missing
73-
76 {
74-
╰────
75-
× function UnicodeSample.externalSimpleMultipleUnnamedReturn
76-
╭─[./test-data/UnicodeSample.sol:80:5]
77-
79
78-
80 │ ╭─▶ /**
79-
81 │ │ * @notice External function that returns a bool
80-
82 │ │ * @dev A dev comment
81-
83 │ │ * @return Some return data
82-
84 │ │ */
83-
85 │ ├─▶ function externalSimpleMultipleUnnamedReturn() external pure returns (bool, uint256) {
84-
· ╰──── @inheritdoc is missing
85-
86 return (true, 111);
86-
╰────
87-
× modifier UnicodeSample.transferFee
88-
╭─[./test-data/UnicodeSample.sol:92:34]
89-
91 */
90-
92 modifier transferFee(uint256 _receiver) virtual {
91-
· ────┬────
92-
· ╰── @param _receiver is missing
93-
93 _;
94-
╰────
5+
x error UnicodeSample.BasicSample_SomeError
6+
,-[./test-data/UnicodeSample.sol:22:41]
7+
21 | */
8+
22 | error BasicSample_SomeError(uint256 _param1);
9+
: ^^^|^^^
10+
: `-- @param _param1 is missing
11+
23 |
12+
`----
13+
x event UnicodeSample.BasicSample_BasicEvent
14+
,-[./test-data/UnicodeSample.sol:27:42]
15+
26 | */
16+
27 | event BasicSample_BasicEvent(uint256 _param1);
17+
: ^^^|^^^
18+
: `-- @param _param1 is missing
19+
28 |
20+
`----
21+
x variable UnicodeSample.somePublicNumber
22+
,-[./test-data/UnicodeSample.sol:35:5]
23+
34 |
24+
35 | ,-> /**
25+
36 | | * @notice A public state variable
26+
37 | | */
27+
38 | |-> uint256 public somePublicNumber;
28+
: `---- @inheritdoc is missing
29+
39 |
30+
`----
31+
x constructor UnicodeSample.constructor
32+
,-[./test-data/UnicodeSample.sol:40:22]
33+
39 |
34+
40 | constructor(bool _randomFlag) {}
35+
: ^^^^^|^^^^^
36+
: `-- @param _randomFlag is missing
37+
41 |
38+
`----
39+
x function UnicodeSample.externalSimple
40+
,-[./test-data/UnicodeSample.sol:42:5]
41+
41 |
42+
42 | ,-> /**
43+
43 | | * @notice External function that returns a bool
44+
44 | | * @dev A dev comment
45+
45 | | * @param _magicNumber A parameter description
46+
46 | | * @param _name Another parameter description
47+
47 | | * @param _name Another parameter description
48+
48 | | * @return _isMagic Some return data
49+
49 | | */
50+
50 | | function externalSimple(uint256 _magicNumber, /* 🦀 */ string memory _name)
51+
51 | | external
52+
52 | | pure
53+
53 | |-> returns (bool _isMagic)
54+
: `---- @inheritdoc is missing
55+
54 | {
56+
`----
57+
x function UnicodeSample.externalSimpleMultipleReturn
58+
,-[./test-data/UnicodeSample.sol:64:5]
59+
63 |
60+
64 | ,-> /**
61+
65 | | * @notice External function that returns a bool
62+
66 | | * @dev A dev comment
63+
67 | | * @param _magicNumber A parameter description
64+
68 | | * @param _name Another parameter description
65+
69 | | * @return _isMagic 🔥 Some return data
66+
70 | | * @return Test test
67+
71 | | */
68+
72 | | function externalSimpleMultipleReturn(uint256 _magicNumber, string memory _name)
69+
73 | | external
70+
74 | | pure
71+
75 | |-> returns (bool _isMagic, uint256)
72+
: `---- @inheritdoc is missing
73+
76 | {
74+
`----
75+
x function UnicodeSample.externalSimpleMultipleUnnamedReturn
76+
,-[./test-data/UnicodeSample.sol:80:5]
77+
79 |
78+
80 | ,-> /**
79+
81 | | * @notice External function that returns a bool
80+
82 | | * @dev A dev comment
81+
83 | | * @return Some return data
82+
84 | | */
83+
85 | |-> function externalSimpleMultipleUnnamedReturn() external pure returns (bool, uint256) {
84+
: `---- @inheritdoc is missing
85+
86 | return (true, 111);
86+
`----
87+
x modifier UnicodeSample.transferFee
88+
,-[./test-data/UnicodeSample.sol:92:34]
89+
91 | */
90+
92 | modifier transferFee(uint256 _receiver) virtual {
91+
: ^^^^|^^^^
92+
: `-- @param _receiver is missing
93+
93 | _;
94+
`----

crates/lintspec/tests/tests-unicode-sample.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#![cfg(feature = "solar")]
22
use lintspec::lint::ValidationOptions;
3+
use miette::GraphicalTheme;
34

45
mod common;
56
use common::*;
67

78
#[test]
89
fn test_unicode() {
10+
let _ = miette::set_hook(Box::new(|_| {
11+
Box::new(
12+
miette::MietteHandlerOpts::new()
13+
.graphical_theme(GraphicalTheme::none())
14+
.build(),
15+
)
16+
}));
917
insta::assert_snapshot!(snapshot_content(
1018
"./test-data/UnicodeSample.sol",
1119
&ValidationOptions::default(),

0 commit comments

Comments
 (0)