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

Add a directory of test cases #7

Open
karbassi opened this issue Aug 31, 2017 · 6 comments
Open

Add a directory of test cases #7

karbassi opened this issue Aug 31, 2017 · 6 comments

Comments

@karbassi
Copy link
Member

karbassi commented Aug 31, 2017

What makes the todo.txt format amazing is the open-source and open-standard of it. There are so many tools written around the format ranging from shell to python to node and everything in between.

The todotxt-cli has a directory of tests that it runs to make sure all cases work. I propose that we create a directory of tests with *.in and *.out files. This allows tool developers to use whatever test framework they want as long as when a *.in file runs through their tool, the *.out matches their output.

Example

0000-add.in

add notice the daisies

0000-add.out

1 notice the daises
TODO: 1 added.

Thoughts and comments welcome.

@inkarkat
Copy link
Member

inkarkat commented Sep 7, 2017

Good idea; this would help ensure compatibility with the CLI.

I think those *.in / *.out files could be auto-generated (via make testdata) from a test run. This would avoid duplication. Though the existing tests could be transformed to also use the new files, I would prefer to keep the current format; it's flexible and has the right granularity.

@karbassi
Copy link
Member Author

karbassi commented Sep 7, 2017

@inkarkat is this something you could take on as a task?

@inkarkat
Copy link
Member

inkarkat commented Sep 8, 2017

Yes, I could do this. Let's first wait for more feedback, though.

Do other implementations actually strictly adhere to the same output format / default highlighting / user messages? Do they support the same command-line switches (such as -p, -f)? If not, the generated output probably wouldn't be useful, or only a subset could be used.

@inkarkat
Copy link
Member

inkarkat commented Sep 8, 2017

I think we also need to store the original contents of todo.txt; your add example starts with an empty one, but usually the tests start out with some initial data. I would store that in an additional 0000-add.txt file.

@bram85
Copy link

bram85 commented Sep 8, 2017

I see limited use for my tool - topydo.

My tool was only inspired by the todo.txt CLI, and I borrowed quite some subcommands, but never intended to mimic the exact behavior. There is highlighting involved, different sorting orders, filters (e.g. items with a threshold). In short, a tool can do anything with the output. Moreover, topydo also does some tricks with the inputs, i.e. converting relative dates to absolute ones.

Of course I could make a fixture with a configuration that approaches the original CLI as close as possible. But I doubt it will always print the desired output (so NOK every time), and the test coverage would be quite low because topydo adds so much on top of input / output processing.

@karbassi
Copy link
Member Author

karbassi commented Sep 8, 2017

@bram85 This brings up a good case.

What could we provide in the spec that would help tool developers cover the base cases? Such as if the "add" command is called with notice the daisies, it should at bare minimum save notice the daisies to the todo.txt file.

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

No branches or pull requests

3 participants