-
-
Notifications
You must be signed in to change notification settings - Fork 525
All generators use common interface #463
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
Conversation
Quick visual scan says "YAY!" |
@@ -0,0 +1 @@ | |||
2.3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file probably shouldn't be updated as part of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops! yeah I'll remove this
def do | ||
defined?(name) ? "HelloWorld.hello('#{name}')" : 'HelloWorld.hello' | ||
def work_load | ||
assertion = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you extract this to a method?
@@ -8,15 +8,15 @@ def do | |||
"TwoBucket.new(#{bucket_one}, #{bucket_two}, #{goal}, '#{start_bucket}')" | |||
end | |||
|
|||
def test_body | |||
def work_load | |||
"two_bucket = #{self.do} | |||
assert_equal #{expected['moves']}, two_bucket.moves | |||
assert_equal '#{expected['goal_bucket']}', two_bucket.goal_bucket | |||
assert_equal #{expected['other_bucket']}, two_bucket.other_bucket" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see work_load
itself not have to be responsible for whitespace/indenting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I tried not to do too much refactoring though and keep the scope of this PR narrow - just focusing and getting the API in place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, that's sensible.
The first one I tried |
The way to test this would be to regenerate all the test files and ensure that the output was identical to the old versions. |
@Insti I did regenerate all of them locally, but obviously I missed something 🙂, Ill fix it in my next push! |
I just tried to do the generate on word-count as it is on #448 which is rebased on master since #451 has been brought in, getting errors there as well. In that case, it is due to single quotes inside of strings that have single quotes as the delimiters. (That is of course the first cause, once fixed the other errors may fix, I did not look that closely) Of course, this may not reflect work done on this PR, since this is not in master yet. |
@bmulvihill the conversions are still very broken. I think you need to go through them all individually and check that the new generated file is the same as the old one. Both of the ones I "randomly" looked at: leap, acronym were very broken. Maybe it would be better to split this PR into smaller PRs that look at each generator individually? |
I'd like to see a PR with some documentation of what the common interface is, you've given a good summary in the OP here, but it probably belongs in the README.md |
I'd rather work_load be renamed workload if that's the name we're going with. 'work' and 'load' are 2 words with many different meanings, 'workload' is one word with a more specific meaning. My but preference for name would be assertion which would make the generic template: def <%= test_case.test_name %>
<%= test_case.skipped %>
<%= test_case.assertion %>
end |
Those last 2 probably should be separate issues so that they can be discussed individually. I really appreciate the effort you're putting into this @bmulvihill ❤️ and agree that it is an important thing to work on, so if we're going to do a lot of work getting it right, we should try to make sure we're doing the right thing and I want to try to help that be as easy as possible. |
@Insti I agree with the name assertion over work_load, I believe in the original issue work_load was suggested. Another name which might make more sense is test_body, since it could technically include more than just an assertion. I can make that change if you want and add a README update to this PR, since I think that makes sense. I will also go back through each generator and compare outputs. |
@kotp, @bmulvihill is there anywhere other than #452 where naming was discussed?
Good point. I'd prefer just
Either that or go fully prefixed to try and avoid the situation where one of the json files in the future has a property called 'skipped' or 'body', or 'test_body'
But that seems a bit redundant. I guess we could discuss it forever. As the person making the PR you have the power to decide what you call it 😉 so choose what you think is best. |
I do prefer the one word Here is where any mention of workload or work_load was discussed or mentioned. |
192abe8
to
3adf16b
Compare
The name "body" I think in the discussions that we did have was determined to be too generic. Body of what? I think this was an important reason why I can't find it at the moment though, even with that search. |
I looked through that search result and also couldn't find any discussion on naming. |
I would go with what @kytrinyx mentioned, because it is likely to be the same in other tracks. |
3adf16b
to
3fd2c27
Compare
I think I sent you a message on Gitter @bmulvihill Let me know if you can't get to it. Can you look at this error, when I generated all files, ran
|
@kotp That test is currently commented out - and when I run it prior to these changes it fails the same way |
Alright. I will look into it more tonight. Wonder why it tests if it is commented out. |
@kotp I think maybe the tests were manually commented out, so when it was regenerated it doesn't have the comments |
I think this is quite likely. The generator needs to be updated to do the commenting out itself. |
Yep, I think we hit this before, where we would have to manually comment them out, which is not something I think we should have to remember to do. Unfortunately, there is nothing in the canonical to indicate these are "long running tests" to help to programmatically trigger this commenting behavior. |
It is possible to detect and special case them in the |
@bmulvihill it probably is a different PR, but it needs to happen before this one can be merged as the tests need to run at a reasonable speed. |
@Insti hmmm ok - I'll take a look at that |
@bmulvihill I'm currently working on the alphametics generator. |
Alphametics generator: #469 |
@bmulvihill fine, thanks for getting us going on this. It started a lot of useful discussion. I need to find some time to work on my new generator branch again. |
Finishes #452
Starts the work of creating a common interface. This PR attempts to standardize 3 public methods
test_name - The method will output the name of the test
workload - This method will output the body of the test
skipped - This method will output skip syntax
I ran all the generators locally and they appear to be working as intended. Once this gets standardized, we may be able to utilize a single example.tt file.
Future ideas: