-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It allows explicitly using PropEr's "native types" feature. This is more powerful than the current automatic parse transform-based inference: * it can be used outside of `?FORALL` to produce PropEr types & combine them with other PropEr or native types. * it allows using the "native types" feature with the proper parse transform disabled * it allows expressing more types directly, without creating additional type aliases, for example: `?TYPE(atom() | float())`. The semantics are identical to automatic inference, if the expression was wrapped in a simple `id` type (when the syntax allows expressing such a type). For example: ```erlang -record(foo, {}). -type id(X) :: X. % semantically equivalent definitions: ?FORALL(X, id(#foo{}), Prop). ?FORALL(X, ?TYPE(#foo{}), Prop). ```
- Loading branch information
1 parent
cfc29e7
commit 50fb72d
Showing
4 changed files
with
75 additions
and
10 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
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,42 @@ | ||
%%% -*- coding: utf-8 -*- | ||
%%% -*- erlang-indent-level: 2 -*- | ||
%%% ------------------------------------------------------------------- | ||
%%% Copyright 2010-2011 Manolis Papadakis <[email protected]>, | ||
%%% Eirini Arvaniti <[email protected]> | ||
%%% and Kostis Sagonas <[email protected]> | ||
%%% | ||
%%% This file is part of PropEr. | ||
%%% | ||
%%% PropEr is free software: you can redistribute it and/or modify | ||
%%% it under the terms of the GNU General Public License as published by | ||
%%% the Free Software Foundation, either version 3 of the License, or | ||
%%% (at your option) any later version. | ||
%%% | ||
%%% PropEr is distributed in the hope that it will be useful, | ||
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
%%% GNU General Public License for more details. | ||
%%% | ||
%%% You should have received a copy of the GNU General Public License | ||
%%% along with PropEr. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
%%% @copyright 2010-2011 Manolis Papadakis, Eirini Arvaniti and Kostis Sagonas | ||
%%% @version {@version} | ||
%%% @doc This module tests whether proper works with parse transforms disabled. | ||
|
||
-module(no_transforms). | ||
-export([prop_1/0, prop_2/0]). | ||
|
||
-define(PROPER_NO_TRANS, true). | ||
|
||
-include_lib("proper/include/proper.hrl"). | ||
|
||
-type local_integer() :: integer(). | ||
-type local_float() :: float(). | ||
|
||
prop_1() -> ?FORALL(X, ?TYPE(local_integer() | local_float()), is_number(X)). | ||
|
||
prop_2() -> ?FORALL(X, native_type(), is_integer(X) orelse is_atom(X)). | ||
|
||
native_type() -> | ||
?TYPE(local_integer() | atom()). |
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