Skip to content

Commit d205521

Browse files
committed
Misc: vendor patched/working ppx_expect.v0.14.1
1 parent ab869a1 commit d205521

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4647
-0
lines changed

vendor/ppx_expect/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
_build
2+
*.install
3+
*.merlin
4+
_opam
5+

vendor/ppx_expect/CHANGES.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
## git version
2+
3+
4+
- Make sure the code we generate can be typed without warning when `-principal`
5+
is passed to the compiler.
6+
7+
## v0.14.1
8+
9+
- Update to be compatible with ppxlib 0.18.0
10+
11+
## v0.11
12+
13+
- Change `ppx_expect` so that when `-diff-cmd -` is passed, they write the
14+
.corrected file but don't diff it or exit with a non-zero exit code.
15+
16+
This is to make expect tests work with jbuilder. Jbuilder uses a separate
17+
build tree, so the current behavior of `ppx_expect` doesn't work well with
18+
jbuilder, especially the in-place behavior.
19+
20+
What is done instead in jbuilder is that after running the test runner, it
21+
checks whether a .corrected file was created. If yes, jbuilder does the
22+
diffing itself, and by default also replaces the source file by the
23+
correction.'
24+
25+
- Regexp and glob matching in the output is now deprecated. This gets in the
26+
way of the "promote" workflow.
27+
People are instead encouraged to prefilter the output before displaying it.
28+
29+
- Tell the build system via output metadata whether a file contains
30+
tests or not
31+
32+
- Depend on ppxlib instead of (now deprecated) ppx\_core, ppx\_driver,
33+
ppx\_metaquot, ppx\_traverse and ppx\_type\_conv.
34+
35+
## v0.10
36+
37+
- In `[%expect]` expressions, disallowed backtraces, which can vary across
38+
compilation configurations (X_LIBRARY_INLINING, flambda, etc.)
39+
40+
- Improved `ppx_expect` to support simultaneous runs of `inline_tests_runner` on
41+
the same file.
42+
43+
- Added expect-test support for reaching a single `[%expect]` multiple times,
44+
where the test only fails if the output was distinct
45+
46+
- For expect tests, relaxed the rule for `%expects` that are reached multiple
47+
times. Instead of requiring all outputs to be identical, require only that
48+
each output individually match the `%expect`.
49+
50+
- In synchronous expect tests, `[%expect]` now captures stderr in addition to
51+
stdout. Previously, there was code that did this for Async expect tests. Now,
52+
stderr is captured in all expect tests.
53+
54+
- Improved expect tests to get the current file when the test runs, rather than
55+
when it is registered.
56+
57+
## v0.9
58+
59+
## 113.43.00
60+
61+
- Always flush Pervasives.stdout in the ppx_expect runtime.
62+
63+
We already do this, but it was missing in one place.
64+
65+
- Made the test framework resilient to user changing the current working directory during the test.
66+
67+
- Print newlines in `"`-strings as real newlines, not `\n`
68+
69+
- The expect test runtime breaks any executable that wants to work even if
70+
cwd doesn't exist, like fe does. Fix that.
71+
72+
It also brings expect tests in line with what ppx\_inline\_test does, and removes the diff
73+
due to absolute paths I was seeing in the output of `./inline_tests_runner -log` in some
74+
other features. Concretely, here is what changes:
75+
76+
- Use the new context-free API
77+
78+
- Change the check in ppx\_expect to be a dynamic check. Instead of
79+
checking that expect tests appears only at toplevel, we test that
80+
they are run in the library they appear.
81+
82+
This has several consquence:
83+
84+
- ppx\_expect can use `Context_free` as well and doesn't require two extra passes
85+
- expect tests can appear inside let%test_module
86+
87+
## 113.33.01
88+
89+
- Add dependency on `re.emacs`
90+
91+
## 113.33.00
92+
93+
- Don't remove trailing semicolons when producing a correction.
94+
95+
- Corrected `%expect`s with double quoted strings don't have the single space padding.
96+
97+
- In the ppx\_expect runtime, flush stdout before redirecting it
98+
This is to avoid capturing leftover of the stdout buffer.
99+
100+
- Make sure the expect-test runtime doesn't generate
101+
`%collector_never_triggered`, which is not accepted by ppx\_expect.
102+
Instead generate:
103+
104+
`%expect {| DID NOT REACH THIS PROGRAM POINT |}`
105+
106+
- Make expect tests pass the user description to the inline test runtime
107+
108+
- Fix a race condition in the ppx\_expect runtime
109+
110+
111+
- Change ppx\_expect be more permissive when matching whitespace in actual output.
112+
See `ppx/ppx_expect/README.org` for details.
113+
114+
Changes to the implementation of ppx\_expect (including some refactoring):
115+
- factorized the common bits between the runtime and ppx rewriter
116+
into one library expect_test_common
117+
- factorized different structures representing the same thing using polymorphism
118+
- communicate data structures between the ppx rewriter and runtime
119+
using a generated lifter instead of hand-written lifters
120+
- splitted the matching and correction writing code: the .corrected is
121+
now only created when needed instead of all the time
122+
- added a concrete syntax tree to represent both the actual output and
123+
expectation in non-exact mode.
124+
This allow to keep the user formatting as much as possible
125+
- made various bits more re-usable
126+
127+
- Change the default style of multi-line expectation to:
128+
129+
`%expect {|
130+
abc
131+
def |}`
132+
133+
More generally, try to preserve the formatting a bit more when
134+
correcting from empty or single to multi-line.
135+
136+
- Arrange things so that when `open Async.Std` is opened, `%expect ...`
137+
expressions are of type `unit Deferred.t` and flush stdout before
138+
capturing the output.
139+
140+
## 113.24.00
141+
142+
Initial release.

vendor/ppx_expect/CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
This repository contains open source software that is developed and
2+
maintained by [Jane Street][js].
3+
4+
Contributions to this project are welcome and should be submitted via
5+
GitHub pull requests.
6+
7+
Signing contributions
8+
---------------------
9+
10+
We require that you sign your contributions. Your signature certifies
11+
that you wrote the patch or otherwise have the right to pass it on as
12+
an open-source patch. The rules are pretty simple: if you can certify
13+
the below (from [developercertificate.org][dco]):
14+
15+
```
16+
Developer Certificate of Origin
17+
Version 1.1
18+
19+
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
20+
1 Letterman Drive
21+
Suite D4700
22+
San Francisco, CA, 94129
23+
24+
Everyone is permitted to copy and distribute verbatim copies of this
25+
license document, but changing it is not allowed.
26+
27+
28+
Developer's Certificate of Origin 1.1
29+
30+
By making a contribution to this project, I certify that:
31+
32+
(a) The contribution was created in whole or in part by me and I
33+
have the right to submit it under the open source license
34+
indicated in the file; or
35+
36+
(b) The contribution is based upon previous work that, to the best
37+
of my knowledge, is covered under an appropriate open source
38+
license and I have the right under that license to submit that
39+
work with modifications, whether created in whole or in part
40+
by me, under the same open source license (unless I am
41+
permitted to submit under a different license), as indicated
42+
in the file; or
43+
44+
(c) The contribution was provided directly to me by some other
45+
person who certified (a), (b) or (c) and I have not modified
46+
it.
47+
48+
(d) I understand and agree that this project and the contribution
49+
are public and that a record of the contribution (including all
50+
personal information I submit with it, including my sign-off) is
51+
maintained indefinitely and may be redistributed consistent with
52+
this project or the open source license(s) involved.
53+
```
54+
55+
Then you just add a line to every git commit message:
56+
57+
```
58+
Signed-off-by: Joe Smith <[email protected]>
59+
```
60+
61+
Use your real name (sorry, no pseudonyms or anonymous contributions.)
62+
63+
If you set your `user.name` and `user.email` git configs, you can sign
64+
your commit automatically with git commit -s.
65+
66+
[dco]: http://developercertificate.org/
67+
[js]: https://opensource.janestreet.com/

vendor/ppx_expect/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2015--2020 Jane Street Group, LLC <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

vendor/ppx_expect/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
2+
3+
default:
4+
dune build
5+
6+
install:
7+
dune install $(INSTALL_ARGS)
8+
9+
uninstall:
10+
dune uninstall $(INSTALL_ARGS)
11+
12+
reinstall: uninstall install
13+
14+
clean:
15+
dune clean
16+
17+
.PHONY: default install uninstall reinstall clean

0 commit comments

Comments
 (0)