-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start implementing <font-weight-absolute>
#62
base: main
Are you sure you want to change the base?
Conversation
atom!("normal") => Ok(Self::Normal(<T![Ident]>::build(p, c))), | ||
atom!("bold") => Ok(Self::Bold(<T![Ident]>::build(p, c))), | ||
atom!("bolder") => Ok(Self::Bolder(<T![Ident]>::build(p, c))), | ||
atom!("lighter") => Ok(Self::Lighter(<T![Ident]>::build(p, c))), | ||
atom => Err(diagnostics::UnexpectedIdent(atom, c.into()))?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this should have a Number => Ok(...)
arm here as well but wasn't sure how to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’ll need something like
if p.peek::<T![Ident]>() {
…
} else if p.peek::<T![Number]>() {
…
}
mod tests { | ||
use super::*; | ||
use crate::test_helpers::*; | ||
|
||
#[test] | ||
fn size_test() { | ||
assert_size!(FontWeightAbsolute, 56); | ||
} | ||
|
||
#[test] | ||
fn test_writes() { | ||
assert_parse!(FontWeightAbsolute, "normal"); | ||
assert_parse!(FontWeightAbsolute, "bold"); | ||
assert_parse!(FontWeightAbsolute, "bolder"); | ||
assert_parse!(FontWeightAbsolute, "lighter"); | ||
assert_parse!(FontWeightAbsolute, "100"); | ||
assert_parse!(FontWeightAbsolute, "500"); | ||
assert_parse!(FontWeightAbsolute, "900"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I run the tests for just this file in isolation so I can quickly get just warnings and errors that relate to this change? I'm a bit overwhelmed with all the output when I run cargo test
:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo test -p hdx_ast
scopes to just the hdx_astpackage, but you can also filter by module or test name so in the case running
cargo test -p hdx_ast css::values::fonts` should scope it to just these tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great so far!
atom!("normal") => Ok(Self::Normal(<T![Ident]>::build(p, c))), | ||
atom!("bold") => Ok(Self::Bold(<T![Ident]>::build(p, c))), | ||
atom!("bolder") => Ok(Self::Bolder(<T![Ident]>::build(p, c))), | ||
atom!("lighter") => Ok(Self::Lighter(<T![Ident]>::build(p, c))), | ||
atom => Err(diagnostics::UnexpectedIdent(atom, c.into()))?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You’ll need something like
if p.peek::<T![Ident]>() {
…
} else if p.peek::<T![Number]>() {
…
}
mod tests { | ||
use super::*; | ||
use crate::test_helpers::*; | ||
|
||
#[test] | ||
fn size_test() { | ||
assert_size!(FontWeightAbsolute, 56); | ||
} | ||
|
||
#[test] | ||
fn test_writes() { | ||
assert_parse!(FontWeightAbsolute, "normal"); | ||
assert_parse!(FontWeightAbsolute, "bold"); | ||
assert_parse!(FontWeightAbsolute, "bolder"); | ||
assert_parse!(FontWeightAbsolute, "lighter"); | ||
assert_parse!(FontWeightAbsolute, "100"); | ||
assert_parse!(FontWeightAbsolute, "500"); | ||
assert_parse!(FontWeightAbsolute, "900"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo test -p hdx_ast
scopes to just the hdx_astpackage, but you can also filter by module or test name so in the case running
cargo test -p hdx_ast css::values::fonts` should scope it to just these tests.
use hdx_lexer::Cursor; | ||
use hdx_parser::{diagnostics, Build, CursorStream, Parse, Parser, Peek, Result as ParserResult, ToCursors, T}; | ||
|
||
mod func { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is, by convention, mod kw
.
But I'd probably get rid of all the keywords and just peek an ident.
Parking this here because I don't know what I'm doing 🫠