Skip to content

docs: update test/README, document skylib - #323

Open
furtib wants to merge 2 commits into
Ericsson:mainfrom
furtib:document-skylib
Open

docs: update test/README, document skylib#323
furtib wants to merge 2 commits into
Ericsson:mainfrom
furtib:document-skylib

Conversation

@furtib

@furtib furtib commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Why:
We want contributors to have an easy time writing tests.

What:

  • Documented how to use skylib to write tests and its limitations.
  • Updated how to add new FOSS tests.
  • Updated how to handle cases where the unit_test macro and skylib fall short.c
  • Added minimal tests for both analysis and unit test in basic tests.

Addresses:
Fixes: #321

@furtib
furtib requested a review from Szelethus August 28, 2026 06:35
@furtib furtib self-assigned this Aug 28, 2026
@furtib furtib added the documentation Improvements or additions to documentation label Aug 28, 2026
@furtib furtib added the test ☑️ Adding or refactoring tests label Aug 28, 2026

@Szelethus Szelethus left a comment

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 find some elements of the new docs a bit overreaching, but I might just be too pedantic. @nettle?

Comment thread test/README.md Outdated
### Create a skylib test

With skylib we can test anything that does not use the output of
`ctx.actions.run` actions (i.e. anything known at analysis time).

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.

Analysis time of bazel, not static analysis time.

@furtib furtib Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair, I have pointed that out!

Comment thread test/README.md Outdated
Comment on lines +163 to +168
| Function | Purpose |
|---|---|
| `asserts.true(env, cond, msg)` | Condition is true |
| `asserts.false(env, cond, msg)` | Condition is false |
| `asserts.equals(env, expected, actual)` | Equality check |
| `asserts.new_set_equals(env, expected, actual)` | Set equality |

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.

There is a fine line in between describing how we do skylib tests here, and essentially duplicating the documentation of another tool here. This might be overkill, also considering that these functions are kind of trivial.

@furtib furtib Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have trimmed it a lot and left the original doc links to fill these gaps.
I'm not sure if the section about aspects should stay, since it is documented in Skylib. Whats your thoughts on this?
I left in custom_attributes, since this is not something that necessarily needs documentation; it's more for giving ideas on what can be done when writing tests.

@furtib
furtib requested a review from Szelethus August 31, 2026 09:03
@nettle

nettle commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

I find some elements of the new docs a bit overreaching, but I might just be too pedantic. @nettle?

As you know I also prefer slim or better very slim documentation.
To me the best documentation is working examples.
The references where developers can find relevant information are more important I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation test ☑️ Adding or refactoring tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to use skylib tests in the repository

3 participants