Skip to content

Commit 17b44fa

Browse files
authored
Merge pull request #75 from mbarbin/fix-cram
Fix cram tests
2 parents 90f8e04 + 9feffa5 commit 17b44fa

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

doc/docs/explanation/linting-equilibrium/comments-in-libraries.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ The `libraries` dependencies listed in `library` stanzas are sorted alphabetical
66
$ cat > dune0 <<EOF\
77
> (library\
88
> (name my_lib)\
9-
> (libraries foo bar baz))
9+
> (libraries foo bar baz))\
10+
> EOF
1011
```
1112
1213
is linted as follows:

test/cram/interactive.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ We disable the pager for the test.
6363

6464
We can quit at any time during the interactive loop.
6565

66-
$ echo 'q' | dunolint lint --config=.dunolint --interactive
66+
$ printf 'q\n' | dunolint lint --config=.dunolint --interactive
6767
Would edit file "dune-project":
6868
-1,1 +1,1
6969
-|(name main)
@@ -73,7 +73,7 @@ We can quit at any time during the interactive loop.
7373

7474
We can choose to refuse some diff, and accept others.
7575

76-
$ echo 'n\ny\n' | dunolint lint --config=.dunolint --interactive
76+
$ printf 'n\ny\n' | dunolint lint --config=.dunolint --interactive
7777
Would edit file "dune-project":
7878
-1,1 +1,1
7979
-|(name main)

test/cram/lint-file.t

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ We test it here while calling it from the shell.
33

44
By default the command reads from `stdin`.
55

6-
$ echo '(lang dune 3.17)' | dunolint tools lint-file
6+
$ printf '(lang dune 3.17)\n' | dunolint tools lint-file
77
Error: Cannot infer the file kind from the filename "stdin".
88
Hint: You may override the filename with the flag [--filename].
99
[123]
1010

1111
However, when using the command that way, the linted file kind won't be
1212
inferred. The filename must end with a basename that indicates a supported mode.
1313

14-
$ echo '(lang dune 3.17)' | dunolint tools lint-file --filename=dune-project
14+
$ printf '(lang dune 3.17)\n' | dunolint tools lint-file --filename=dune-project
1515
(lang dune 3.17)
1616

1717
By default, the contents is auto-formatted.
1818

19-
$ echo '(lang\n dune\n 3.17)' | dunolint tools lint-file --filename=dune-project
19+
$ printf '(lang\n dune\n 3.17)\n' | dunolint tools lint-file --filename=dune-project
2020
(lang dune 3.17)
2121

2222
The formatting may however be disabled.
2323

24-
$ echo '(lang\n dune\n 3.17)' \
24+
$ printf '(lang\n dune\n 3.17)\n' \
2525
> | dunolint tools lint-file --filename=dune-project \
2626
> --format-file=false
2727
(lang
@@ -100,7 +100,7 @@ When the command fails to parse the file, it complains and exits with a non-zero
100100
code. This should be handled by the logic responsible for the editor
101101
integration.
102102

103-
$ echo "(invalid sexp" | dunolint tools lint-file --filename=dune
103+
$ printf "(invalid sexp\n" | dunolint tools lint-file --filename=dune
104104
File "dune", line 2, characters 0-0:
105105
Error: unclosed parentheses at end of input
106106
[123]
@@ -109,7 +109,7 @@ Next we are going to test the command with config.
109109

110110
The command may be passed a config file.
111111

112-
$ echo '((rules ()))' > .dunolint
112+
$ printf '((rules ()))\n' > .dunolint
113113

114114
$ dunolint tools lint dune --config=.dunolint
115115
(library
@@ -255,9 +255,10 @@ contents is saved in the input file and not at the overridden path.
255255
(name mylib)
256256
(libraries a b c))
257257

258-
$ ls -l path/to/dune
259-
ls: cannot access 'path/to/dune': No such file or directory
260-
[2]
258+
This should not have created a file with the given filename.
259+
260+
$ test -e path/to/dune
261+
[1]
261262

262263
The command is idempotent.
263264

test/cram/lint.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ its own. See below how the name of the project is not linted:
3737

3838
If the config is supplied, but it is invalid, dunolint will complain.
3939

40-
$ echo '(blah)' > .dunolint
40+
$ printf '(blah)\n' > .dunolint
4141

4242
$ dunolint lint --yes --config .dunolint 2> /dev/null
4343
[125]
4444

4545
If there are no rules, the linting will succeed but does nothing in this case.
4646

47-
$ echo '((rules ()))' > .dunolint
47+
$ printf '((rules ()))\n' > .dunolint
4848

4949
$ dunolint lint --yes --config .dunolint
5050

0 commit comments

Comments
 (0)