rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: David Gow <davidgow@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"José Expósito" <jose.exposito89@gmail.com>,
	"Brendan Higgins" <brendan.higgins@linux.dev>,
	"Rae Moar" <rmoar@google.com>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Matt Gilbride" <mattgilbride@google.com>,
	kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] rust: macros: add macro to easily run KUnit tests
Date: Tue, 29 Oct 2024 22:16:51 -0700	[thread overview]
Message-ID: <ZyHBQzR_17qfcpng@Boquns-Mac-mini.local> (raw)
In-Reply-To: <ZyHACjac2gk4M5MX@Boquns-Mac-mini.local>

On Tue, Oct 29, 2024 at 10:11:38PM -0700, Boqun Feng wrote:
[...]
> > +
> > +    let new_body: TokenStream = vec![body.stream(), kunit_macros.parse().unwrap()]
> > +        .into_iter()
> > +        .collect();
> > +
> > +    // Remove the `#[test]` macros.
> > +    let new_body = new_body.to_string().replace("#[test]", "");
> 
> Yeah, I want to see how you do it this time ;-) So if you do a
> `.to_string()` on a `TokenStream`, you lose all the span [1] information
> ("span information" is a term invited by me, hope I get it right ;-))

Not important: I meant I am not a procdure macro expert, hope "span
information" is what is used when discussing span preservation ;-)

Regards,
Boqun

> e.g. if there is a compile error in the test code, the compiler cannot
> report the exact line of the error, it can only report there is an
> error.
> 
[...]

  reply	other threads:[~2024-10-30  5:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30  4:57 [PATCH v3 0/3] rust: kunit: Support KUnit tests with a user-space like syntax David Gow
2024-10-30  4:57 ` [PATCH v3 1/3] rust: kunit: add KUnit case and suite macros David Gow
2024-10-30  4:57 ` [PATCH v3 2/3] rust: macros: add macro to easily run KUnit tests David Gow
2024-10-30  5:11   ` Boqun Feng
2024-10-30  5:16     ` Boqun Feng [this message]
2024-11-01  6:44     ` David Gow
2024-10-30  4:57 ` [PATCH v3 3/3] rust: kunit: allow to know if we are in a test David Gow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZyHBQzR_17qfcpng@Boquns-Mac-mini.local \
    --to=boqun.feng@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=brendan.higgins@linux.dev \
    --cc=davidgow@google.com \
    --cc=gary@garyguo.net \
    --cc=jose.exposito89@gmail.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mattgilbride@google.com \
    --cc=ojeda@kernel.org \
    --cc=rmoar@google.com \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).