Skip to content
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

Pass extra arguments onwards #10

Merged
merged 1 commit into from
Nov 22, 2021
Merged

Conversation

badboy
Copy link
Contributor

@badboy badboy commented Nov 22, 2021

It's documented that one can pass any further options,
but these weren't passed on and thus always ignored.


Thank you for this crate!

It's documented that one can pass any further options,
but these weren't passed on and thus always ignored.
@scrabsha
Copy link
Owner

Thanks! I think this deserves a 0.1.1 release 😅.

@scrabsha scrabsha merged commit caf6b04 into scrabsha:main Nov 22, 2021
scrabsha pushed a commit that referenced this pull request Nov 22, 2021
In previous implementation, there was a `dep_doc` (resp. `dev_dep_doc`
macro, which expanded to the concatenation of the following:
  - the beginning of a code snippet with the section `[dependencies]`
    (resp. `[dev-dependencies])`,
  - a call to package_import with the correct package name and version
    passed as argument,
  - the ned of the code snippet.

The problem with this approach is that it was not possible to test the
complete expansion of a macro, given a crate name, a version and some
other information. This even resulted to a bug where we forgot to pass
the so called "other information" to the package_import. See #10 for
more.

This commit allows for simple testing by adding an additional
intermediate step. The `dep_doc` (resp. `dev_dep_doc`) macro now expands
to a call to `dep_doc_inner` (resp. `dev_dep_doc_inner`), with the crate
name and version guessed from the environment and the
"other information". `dep_doc_inner` (resp. `dev_dep_doc`) is then
responsible for generating the concatenation described previously.

As such, most of the expansion process can be tested by calling
`dep_doc_inner` (resp. `dev_dep_doc_inner`).
scrabsha added a commit that referenced this pull request Nov 22, 2021
In previous implementation, there was a `dep_doc` (resp. `dev_dep_doc`
macro, which expanded to the concatenation of the following:
  - the beginning of a code snippet with the section `[dependencies]`
    (resp. `[dev-dependencies])`,
  - a call to package_import with the correct package name and version
    passed as argument,
  - the ned of the code snippet.

The problem with this approach is that it was not possible to test the
complete expansion of a macro, given a crate name, a version and some
other information. This even resulted to a bug where we forgot to pass
the so called "other information" to the package_import. See #10 for
more.

This commit allows for simple testing by adding an additional
intermediate step. The `dep_doc` (resp. `dev_dep_doc`) macro now expands
to a call to `dep_doc_inner` (resp. `dev_dep_doc_inner`), with the crate
name and version guessed from the environment and the
"other information". `dep_doc_inner` (resp. `dev_dep_doc`) is then
responsible for generating the concatenation described previously.

As such, most of the expansion process can be tested by calling
`dep_doc_inner` (resp. `dev_dep_doc_inner`).

A bunch of tests have been added in the process in order to ensure that
the previously linked bug won't happen again.
@scrabsha scrabsha mentioned this pull request Nov 22, 2021
scrabsha pushed a commit that referenced this pull request Nov 22, 2021
This release allows us to publish a fix merged in #10.
scrabsha added a commit that referenced this pull request Nov 22, 2021
This release allows us to publish a fix merged in #10.

The expansion has been rearranged along the way in order to make it easier to test.
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.

2 participants