Skip to content

Make test case recorder #59

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

Closed
1 of 2 tasks
pokey opened this issue Jul 2, 2021 · 12 comments · Fixed by #87
Closed
1 of 2 tasks

Make test case recorder #59

pokey opened this issue Jul 2, 2021 · 12 comments · Fixed by #87
Labels
code quality Improvements to code quality

Comments

@pokey
Copy link
Member

pokey commented Jul 2, 2021

Goal: to make it super lightweight to make a new test case so that you don’t think twice about it, while keeping them robust enough not to rot if we rework internals

  • New command cursorless.recordTestCase, which asks for a test case name / maybe directory

  • Waits for next cursorless command

  • On next cursorless command, takes a snapshot of current file, including cursor locations, visible lines, file type, and relevant decorations

  • Takes snapshot after cursorless command, including cursor and visible lines

  • Saves before, command, context, and after as a test case

  • Then add code that can parse this type of fixture and run it as a test

  • I'd argue that cursorless command should be captured pre-inference, but don't feel strongly

  • This technique can be used for testing transformations, inside / outside, actions, etc

  • For example, to check whether the delimiter / inside outside stuff is working for eg "type" transformation, can run the command with "take" and "Chuck". This makes it robust to changes in internal representations, at the expense of being slightly less granular

  • Also save highlights to make sure those don't break?

  • could then also use these test cases to automatically record GIFs (Make GIF generator using existing test cases #215)

  • let's use this one to capture Add type transformation #32 (comment) as a test case

Extra credit is:

  • capture clipboard before and after

Follow-on issues filed:

@pokey pokey added the code quality Improvements to code quality label Jul 2, 2021
@pokey pokey mentioned this issue Jul 3, 2021
@pokey pokey added this to the Get pokey off the critical path milestone Jul 5, 2021
@pokey
Copy link
Member Author

pokey commented Jul 6, 2021

Note that we'll probably want to finish #69 before we record any test cases as that will change the wire format from talon

@pokey
Copy link
Member Author

pokey commented Jul 7, 2021

Use this to test:

  • extracting name from exported classes and functions in Typescript
  • extracting name from decorated classes and functions in Python

@brxck brxck mentioned this issue Jul 8, 2021
@pokey
Copy link
Member Author

pokey commented Jul 12, 2021

To test:

  • Delimiters get removed from source of "move" and "cut"
  • "that" gets set properly
  • Behaviour of "wrap" wrt current selection:
    • Target selected
    • Cursor at beginning of target
    • Cursor at end of target
    • Cursor bigger than target tot left / right / both
    • Multiple cursors? (Eg one cursor at end and one at beginning, etc)

@pokey
Copy link
Member Author

pokey commented Jul 13, 2021

  • space delimited sequence support when combined with punctuation, eg for "This is, a test!":
    • "chuck sit"
    • "move sit after each"
    • "move air after each"
    • "move each before air"
    • "bring air before bang"

@pokey
Copy link
Member Author

pokey commented Jul 13, 2021

  • Make sure leading delimiter with "chuck type" gets deleted

@pokey
Copy link
Member Author

pokey commented Jul 21, 2021

@AndreasArvidsson
Copy link
Member

To test

  • Excluding positions in ranges. take air until bat take air tween bat

@pokey
Copy link
Member Author

pokey commented Jul 30, 2021

More to add:

  • "move sit to before file"
  • "chuck last char air"

@pokey pokey closed this as completed in #87 Jul 31, 2021
@pokey
Copy link
Member Author

pokey commented Aug 3, 2021

  • Make sure basic things work in unsupported languages

@pokey
Copy link
Member Author

pokey commented Aug 3, 2021

  • Multi-target inference rules, eg "swap funk air with bat", "swap air with funk bat", etc

@pokey
Copy link
Member Author

pokey commented Aug 6, 2021

  • select a token, then wrap it and make sure selection in right place

@pokey
Copy link
Member Author

pokey commented Aug 6, 2021

  • "take token" / "take first word" when cursor is at beginning, middle and end of token

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improvements to code quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants