这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dvulakh
Copy link

@dvulakh dvulakh commented Jun 5, 2024

This repo includes a large number of tests that stress many shapes of input code. However, most of these tests do not currently exercise the janestreet profile.

This PR extends the test suite in test/passing/tests with *.js-ref and *.js-err files. They are analagous to *.ref and *.err files, except that

  • They are formatted with --profile=janestreet
  • They ignore extra command-line arguments in *.opts files

To ensure comprehensiveness, the build rules require that every test for the default profile have either a corresponding *.js-ref file, or a corresponding *.why-no-js file (that file should contain a short message describing why the test is not relevant to the janestreet profile).

This PR also merges js_source.ml and source.ml, since source.ml.js-ref can now test what was previously stressed in js_source.ml.ref. One structure item formerly in js_source.ml is split out into comment_long_js_only.ml, because the ocamlformat profile does not stabilize on it.

This PR should be reviewed together with the internal re-import, which shows that the tests added here agree with the (more limited) internal testing we have been applying until now.

dvulakh added 10 commits May 31, 2024 09:48
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
we don't internally permit command-line configuration, so we're mostly
interested in the default behavior of the janestreet profile

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
when the [*.js-ref] tests obeyed [.ocamlformat] and [*.opts], we used
[*.opts] to increase the default low [--max-iters]

now that we ignore [.ocamlformat] from [*.js-ref] tests, we don't need
to change [*.opts]

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
we check that every non-js test either has a corresponding js test, or
an explanation of why it shouldn't be stressed under the janestreet
profile

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
also merge [source.ml] and [js_source.ml]

one [*.opts] with [--profile=janestreet] remains because it is for a
file that is currently broken in the ocamlformat profile

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
it suffices for these tests to run during local development on linux
and as part of the github ci

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Copy link

@mdelvecchio-jsc mdelvecchio-jsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than the suggestion I left.

(enabled_if (<> %%{os_type} Win32))
(package ocamlformat)
(action (system "if [%s -f tests/%s.why-no-js ]; then echo '%s'; exit 1; fi")))
|}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know during the running of gen.ml whether or not both/neither are present; lets only print out a rule like this if we know it's going to fail.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Done.

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Copy link

@mdelvecchio-jsc mdelvecchio-jsc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dvulakh dvulakh merged commit 67727be into jane Jun 7, 2024
@dvulakh dvulakh deleted the dvulakh.add-js-tests branch June 7, 2024 18:36
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

Successfully merging this pull request may close these issues.

3 participants