-
Notifications
You must be signed in to change notification settings - Fork 45
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
Generate test files #312
base: main
Are you sure you want to change the base?
Generate test files #312
Conversation
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 looks great!
Can you generate all the int tests into one file (IntTests.res, etc) per language?
To get the module name, see here https://rescript-lang.org/docs/manual/latest/use-illegal-identifier-names
Note that the convention in unit tests is to put the actual argument as the first parameter. I don't know if that's the case for all the test suites we're using, best to check to confirm.
For labelled arguments, I'd add a label to each definition in the yaml. Use null
if there isn't a label.
json-files/Int.absolute.json
Outdated
@@ -0,0 +1,45 @@ | |||
{ | |||
"module": "Int", |
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.
Let's not check in the json files
I don't think that would be possible. The tests are generated one at a time because the functions are in separate files. Please correct me if I'm wrong.
And where will we add the labels?
I think the issue stems from the types into which we are parsing the data. Here the inputs are always arrays of ints, and the output is an int. is there a way to make accept different types (ints, floats, strings, arrays, etc.)? I tried Js.Dict.t, but it didn't work.
|
Ah, I think you're saying that you run the script on each yaml? In that case, you'd run the script on all the yamls in a directory and generate it all at once.
I meant the label field would indicate if this parameter should be a label in languages that support it. So it would be a boolean field, and the parameter would have the name in
Hmmm, maybe inputs would be a Json.t (https://rescript-lang.org/docs/manual/latest/api/js/json#t)? |
I tried a completely new method to generate the test files.
Tried to use it on Array.length function and I'm facing this issue |
Yes, I am running the script on each yaml (json). As a result, new files are generated (one for each language) containing the tests for a specific function. |
First attempt at solving issue #309.
Issues:
Maybe something like this can solve this issue: