tree-sitter icon indicating copy to clipboard operation
tree-sitter copied to clipboard

Is there a way to skip a corpus test?

Open stsewd opened this issue 5 years ago • 4 comments

Hi, I'm writing a grammar, and I've needed this a couple of times. Is there a way to skip just one test? I know there is the --filter option, but not really what I need.

stsewd avatar Jun 14 '20 21:06 stsewd

Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.81. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jun 14 '20 21:06 issue-label-bot[bot]

@stsewd Do you have suggestions how such skipping should work? My thoughts were to add a stable sequential numbering through all tests in the output and provide ability to select/deselect tests by numbers. What do you think about?

Requires: #373

ahlinc avatar Aug 26 '21 22:08 ahlinc

I was thinking something more like a marker/metadata on each test.

==================
Test (skip)
==================

test with failures

----

(some_nodes (that-are-not-working-yet)

If the test passes, it would be marked as an error in the test command.

stsewd avatar Aug 26 '21 22:08 stsewd

A "jank" way I found to do this is to prepend two space characters to the test you want to skip.

  ==================
  Plain struct
  ==================
  
  struct Point {
      x: i64
      y: i64
  }
  
  ---
  
  (source_file)

The cli seems to skip this entire block. Not sure why this works, but it does.

Edit: This does not work if there are other tests in the file. The corpus parser gets all screwy. Another workaround I found is to prepend ";" to the test to be skipped if it comes after an un-skipped test.

demizer avatar May 24 '22 04:05 demizer

I was thinking something more like a marker/metadata on each test.

==================
Test (skip)
==================

test with failures

----

(some_nodes (that-are-not-working-yet)

If the test passes, it would be marked as an error in the test command.

Ideally, would the marker be fed into the cli arg? As in, something like --skip-marker="(skip)"? I don't think picking a universal skip marker would be good, as someone might just use that in their test name

amaanq avatar Aug 03 '23 18:08 amaanq

I thought about different markers on my own needs like error nodes is expected in a tree (and prohibited by default). I'd suggest the following syntax like:

==================
Test
:skip
:error
==================

So flags would be possible after a title and start with colon without any indents. It would be easy to search for such flags with a regular text search. Also such format allows to add parameters for specific flags in the future.

ahlinc avatar Aug 03 '23 19:08 ahlinc

Implemented in #3060.

ObserverOfTime avatar Apr 11 '24 16:04 ObserverOfTime