forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ocaml#9086 from wyn/8945_show_constructor
toplevel, show directive for constructors
- Loading branch information
Showing
3 changed files
with
163 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
(* TEST | ||
* expect | ||
*) | ||
|
||
(* this is a set of tests to test the #show functionality | ||
* of toplevel *) | ||
|
||
#show Foo;; | ||
[%%expect {| | ||
Unknown element. | ||
|}];; | ||
|
||
module type S = sig type t val x : t end;; | ||
module M : S = struct type t = int let x = 3 end;; | ||
|
||
[%%expect {| | ||
module type S = sig type t val x : t end | ||
module M : S | ||
|}];; | ||
|
||
#show M;; | ||
[%%expect {| | ||
module M : S | ||
|}];; | ||
|
||
#show S;; | ||
[%%expect {| | ||
module type S = sig type t val x : t end | ||
|}];; | ||
|
||
#show Invalid_argument;; | ||
[%%expect {| | ||
exception Invalid_argument of string | ||
|}];; | ||
|
||
#show Some;; | ||
[%%expect {| | ||
type 'a option = None | Some of 'a | ||
|}];; | ||
|
||
#show option;; | ||
[%%expect {| | ||
type 'a option = None | Some of 'a | ||
|}];; | ||
|
||
#show Open_binary;; | ||
[%%expect {| | ||
type Stdlib.open_flag = | ||
Open_rdonly | ||
| Open_wronly | ||
| Open_append | ||
| Open_creat | ||
| Open_trunc | ||
| Open_excl | ||
| Open_binary | ||
| Open_text | ||
| Open_nonblock | ||
|}];; | ||
|
||
#show open_flag;; | ||
[%%expect {| | ||
type open_flag = | ||
Open_rdonly | ||
| Open_wronly | ||
| Open_append | ||
| Open_creat | ||
| Open_trunc | ||
| Open_excl | ||
| Open_binary | ||
| Open_text | ||
| Open_nonblock | ||
|}];; | ||
|
||
type extensible = ..;; | ||
type extensible += A | B of int;; | ||
[%%expect {| | ||
type extensible = .. | ||
type extensible += A | B of int | ||
|}];; | ||
|
||
#show A;; | ||
[%%expect {| | ||
type extensible += A | ||
|}];; | ||
|
||
#show B;; | ||
[%%expect {| | ||
type extensible += B of int | ||
|}];; | ||
|
||
#show extensible;; | ||
[%%expect {| | ||
type extensible = .. | ||
|}];; | ||
|
||
type 'a t = ..;; | ||
type _ t += A : int t;; | ||
[%%expect{| | ||
type 'a t = .. | ||
type _ t += A : int t | ||
|}];; | ||
|
||
#show A;; | ||
[%%expect{| | ||
type 'a t += A : int t | ||
|}];; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters