Skip to content

Fix unit tests and run them on CI - #436

Merged
mrobinson merged 2 commits into
servo:mainfrom
SimonSapin:unit-tests
Aug 4, 2026
Merged

Fix unit tests and run them on CI#436
mrobinson merged 2 commits into
servo:mainfrom
SimonSapin:unit-tests

Conversation

@SimonSapin

Copy link
Copy Markdown
Member

No description provided.

#[test]
fn parse_valid_mapping_list() {
let mut mappings = parse_mapping_list("foo: bar, totally-invalid-mapping,,");
let mut mappings = parse_mapping_list("foo: bar, totally-invalid-mapping:,,");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test was failing: the second call to mappings.next() expected None but instead got Some(("totally-invalid-mapping", "totally-invalid-mapping")) which did look valid per:

https://drafts.csswg.org/css-shadow-1/#parsing-mapping

  1. If the end of the input has been reached, return the tuple (first token, first token)

This modified test case goes through here instead:

  1. If second token is empty then return error.

Comment thread .github/workflows/main.yml Outdated
Comment on lines +20 to +21
- name: Run Tests
run: cargo build --features servo
run: cargo test --features servo

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thing these steps were already named "Run Tests" :)

Signed-off-by: Simon Sapin <simon@igalia.com>
Comment thread .github/workflows/main.yml Outdated
Comment on lines +45 to +44
run: cargo build --features servo
run: cargo test --features servo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make these separately build and then test. Test doesn't always catch everything that build does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t believe that’s true unless in specific configurations not used in the repo (the library crate is compiled as a dependency of doctests before rustdoc finds out whether there are any) but I don’t think it hurts either, so done.

I’ve also added --workspace to both commands, and removed --features servo since it’s the default.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've had issues with feature flags before. And of course #[cfg(test)] can affect things. But I'm happy to go with this this if you think it's fine. We can always change it later if we run into issues.

@nicoburns

Copy link
Copy Markdown
Collaborator

Note: Stylo also has integration tests in:

I believe these are two copies of the same tests, which are probably no longer in sync with each other. Might be worth reconciling those copies.

If we could get the tests fixed/running then we could upstream our fixes to the Firefox copy, start syncing them into this repo as part of our regular syncs, and delete the copy in the Servo repo.

Signed-off-by: Simon Sapin <simon@igalia.com>
@Loirooriol

Copy link
Copy Markdown
Collaborator

If we could get the tests fixed/running then we could upstream our fixes to the Firefox copy

And in particular it would be good to make sure they do run in Firefox, so that when refactorings happen upstream, I don't have to adapt the tests

@SimonSapin

Copy link
Copy Markdown
Member Author

(Thanks for the approvals but I don’t have access to add to the merge queue for this repo)

@mrobinson
mrobinson added this pull request to the merge queue Aug 4, 2026
Merged via the queue into servo:main with commit 127b0b5 Aug 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants