Skip to content

Commit d7a97e1

Browse files
committed
fix: Update tests to reflect refactor
1 parent a81bfe8 commit d7a97e1

File tree

7 files changed

+539
-501
lines changed

7 files changed

+539
-501
lines changed

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
[workspace]
22
resolver = "2"
33
members = [
4-
"packages/cli",
5-
"packages/engine",
6-
"packages/macro",
7-
"packages/macro_impl",
8-
"packages/macro_core",
4+
"packages/*",
95
]
106

117
[workspace.package]
@@ -26,6 +22,9 @@ thiserror = "2.0.11"
2622
colored = "3.0.0"
2723
pretty_assertions = "1.4.1"
2824

25+
[workspace.lib]
26+
doctest = false
27+
2928
[profile.release]
3029
strip = true
3130
debug = false

packages/engine/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ pretty_assertions = { workspace = true }
1515
[features]
1616
default = ["cli"]
1717
cli = ["dep:colored"]
18-
no-color = ["colored/no-color"]
18+
no-color = ["colored/no-color"]
19+
20+
[lib]
21+
doctest = false

packages/engine/src/cursor.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub type CursorTuple = (u16, u16);
22

3-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
3+
#[derive(Debug, Clone, Copy, Eq)]
44
pub struct Cursor {
55
pub col: u16,
66
pub line: u16,
@@ -16,6 +16,22 @@ impl Cursor {
1616
}
1717
}
1818

19+
pub fn from(line: u16, col: u16) -> Self {
20+
Self {
21+
col,
22+
line,
23+
index: 0
24+
}
25+
}
26+
27+
pub fn from_full(col: u16, line: u16, index: u32) -> Self {
28+
Self {
29+
col,
30+
line,
31+
index
32+
}
33+
}
34+
1935
/// Goes to the new line if needed, based on the character
2036
pub fn next(&mut self, char: &char) {
2137
if char.eq(&'\n') {
@@ -57,6 +73,12 @@ impl Cursor {
5773
}
5874
}
5975

76+
impl PartialEq for Cursor {
77+
fn eq(&self, other: &Self) -> bool {
78+
self.col == other.col && self.line == other.line
79+
}
80+
}
81+
6082
impl From<Cursor> for CursorTuple {
6183
fn from(val: Cursor) -> Self {
6284
val.to_tuple()

0 commit comments

Comments
 (0)