Skip to content

Commit 1333bef

Browse files
authored
Merge pull request #6 from samoht/rename
Rename ocaml-cram to craml
2 parents 7adbbe0 + 6e73464 commit 1333bef

File tree

8 files changed

+31
-57
lines changed

8 files changed

+31
-57
lines changed

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
## ocaml-cram: CRAM testing framework
1+
## craml: A CRAM-testing framework for testing shell scripts
22

33
CRAM is a is functional testing framework for command line
4-
applications. `ocaml-cram` is freely inspired by the [Python
4+
applications. `craml` is freely inspired by the [Python
55
tool](https://bitheap.org/cram/), which was itself based on
66
Mercurial's [unified test
77
format](https://www.selenic.com/blog/?p=663).
88

9-
Ocaml-cram is released as a single binary (called `cram`) and
9+
`craml` is released as a single binary (called `craml`) and
1010
supports the following syntax:
1111

1212
- Lines beginning with two spaces, a dollar sign, and a space are
@@ -30,48 +30,48 @@ supports the following syntax:
3030
in the middle of an output as it is not clear what should be done
3131
to them when the output changes.
3232

33-
To run the tests described in a `<file>`, use `cram <file>`. This will
33+
To run the tests described in a `<file>`, use `craml <file>`. This will
3434
run all the commands in sequence and will generated `<file>.corrected`
3535
if one of the output do not match the expected command outputs.
3636

3737
### Non-deterministic Outputs
3838

39-
Ocaml-cram supports non-deterministic outputs:
39+
`craml` supports non-deterministic outputs:
4040

4141
```
4242
<-- non-deterministic
4343
$ <command>
4444
<output>
4545
```
4646

47-
In that case, `cram <file>` will run the command but will not
47+
In that case, `craml <file>` will run the command but will not
4848
generate `<file>.corrected` if the new output differs from the one
49-
described in the file. Use `cram --non-deterministic <file>` to come
49+
described in the file. Use `craml --non-deterministic <file>` to come
5050
back to the default behaviour.
5151

5252
### Non-deterministic Commands
5353

54-
Ocaml-cram supports non-deterministic outputs:
54+
`craml` supports non-deterministic outputs:
5555

5656
```
5757
<-- non-deterministic [skip]
5858
$ <command>
5959
<output>
6060
```
6161

62-
In that case, `cram <file>` will *not* run the command. Use `cram
62+
In that case, `craml <file>` will *not* run the command. Use `craml
6363
--non-deterministic <file>` to come back to the default behaviour.
6464

6565
### Exit Codes
6666

67-
Ocaml-cram tests exit codes:
67+
`craml` tests exit codes:
6868

6969
```
7070
$ <command>
7171
<output>
7272
--> exit 10
7373
```
7474

75-
If `<command>` does not exit with code 10, then `cram <file>` will
75+
If `<command>` does not exit with code 10, then `craml <file>` will
7676
generate `<file>.corrected` with the right exit code. Note that `@@
7777
exit 0` will not be displayed.

bin/convert.ml

-24
This file was deleted.

bin/jbuild

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
(executable
44
((name main)
5-
(public_name cram)
5+
(public_name craml)
66
(modules (main))
7-
(libraries (fmt cram unix cmdliner logs.cli logs.fmt fmt.cli fmt.tty))))
8-
9-
(executable ((name convert) (modules convert)))
7+
(libraries (fmt craml unix cmdliner logs.cli logs.fmt fmt.cli fmt.tty))))

bin/main.ml

+12-12
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ let ansi_color_strip str =
3535

3636
(* http://tldp.org/LDP/abs/html/here-docs.html *)
3737
let use_heredoc t =
38-
String.cut (List.hd t.Cram.command) ~sep:"<<" <> None
38+
String.cut (List.hd t.Craml.command) ~sep:"<<" <> None
3939

4040
let command_of_test t =
4141
if not (use_heredoc t) then
42-
String.concat ~sep:" " t.Cram.command
42+
String.concat ~sep:" " t.Craml.command
4343
else
44-
String.concat ~sep:"\n" t.Cram.command
44+
String.concat ~sep:"\n" t.Craml.command
4545

4646
let run_test temp_file t =
4747
let cmd = command_of_test t in
@@ -54,36 +54,36 @@ let run_test temp_file t =
5454
| _ -> 255
5555

5656
let run () non_deterministic expect_test =
57-
Cram.run expect_test ~f:(fun file_contents items ->
57+
Craml.run expect_test ~f:(fun file_contents items ->
5858
let temp_file = Filename.temp_file "cram" ".output" in
5959
at_exit (fun () -> Sys.remove temp_file);
6060
let buf = Buffer.create (String.length file_contents + 1024) in
6161
let ppf = Format.formatter_of_buffer buf in
6262
List.iter (function
63-
| Cram.Line l -> Cram.pp_line ppf l
64-
| Cram.Test t ->
65-
match non_deterministic, t.Cram.non_deterministic with
63+
| Craml.Line l -> Craml.pp_line ppf l
64+
| Craml.Test t ->
65+
match non_deterministic, t.Craml.non_deterministic with
6666
| false, `Command ->
6767
(* the command is non-deterministic so skip everything *)
68-
List.iter (Cram.pp_line ppf) t.Cram.lines
68+
List.iter (Craml.pp_line ppf) t.Craml.lines
6969
| false, `Output ->
7070
(* the command's output is non-deterministic; run it but
7171
keep the old output. *)
7272
let _ = run_test temp_file t in
73-
List.iter (Cram.pp_line ppf) t.Cram.lines
73+
List.iter (Craml.pp_line ppf) t.Craml.lines
7474
| _ ->
7575
let n = run_test temp_file t in
7676
let lines = read_lines temp_file in
7777
let output =
7878
let output = List.map (fun x -> `Output x) lines in
79-
if Cram.equal_output output t.output then t.output else output
79+
if Craml.equal_output output t.output then t.output else output
8080
in
81-
Fmt.pf ppf " $ %a\n" Cram.pp_command t.Cram.command;
81+
Fmt.pf ppf " $ %a\n" Craml.pp_command t.Craml.command;
8282
List.iter (function
8383
| `Ellipsis -> Fmt.pf ppf " ...\n"
8484
| `Output line -> Fmt.pf ppf " %s\n" (ansi_color_strip line)
8585
) output;
86-
Cram.pp_exit_code ppf n
86+
Craml.pp_exit_code ppf n
8787
) items;
8888
Format.pp_print_flush ppf ();
8989
Buffer.contents buf)

cram.opam craml.opam

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
opam-version: "1.2"
22
maintainer: "Thomas Gazagnaire <[email protected]>"
33
authors: ["Thomas Gazagnaire <[email protected]"]
4-
homepage: "https://github.com/realworldocaml/ocaml-cram"
4+
homepage: "https://github.com/realworldocaml/craml"
55
license: "ISC"
6-
dev-repo: "https://github.com/realworldocaml/ocaml-cram.git"
7-
bug-reports: "https://github.com/realworldocaml/ocaml-cram/issues"
6+
dev-repo: "https://github.com/realworldocaml/craml.git"
7+
bug-reports: "https://github.com/realworldocaml/craml/issues"
88

99
build: [
10-
["jbuilder" "subst"] {pinned}
10+
["jbuilder" "subst" "-p" name] {pinned}
1111
["jbuilder" "build" "-p" name "-j" jobs]
1212
]
1313
build-test: ["jbuilder" "runtest" "-p" name]

lib/cram.ml lib/craml.ml

File renamed without changes.

lib/cram.mli lib/craml.mli

File renamed without changes.

lib/jbuild

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
(jbuild_version 1)
22

33
(library
4-
((name cram)
5-
(public_name cram)
4+
((name craml)
5+
(public_name craml)
66
(libraries (fmt astring logs))))
77

88
(ocamllex (lexer))

0 commit comments

Comments
 (0)