Comparing version 0.6.0-alpha.1 to 0.6.0-alpha.2
## Release History | ||
- **0.6.0-alpha.2** — *2015-04-24* — jsc.bless | ||
- Added `jsc.bless` | ||
- **0.6.0-alpha.1** — *2015-04-22* — Preview | ||
@@ -4,0 +6,0 @@ - Using lazy sequences for shrink results |
@@ -23,6 +23,2 @@ "use strict"; | ||
/** | ||
- `arb.bless({...}): arbitrary a` | ||
Bless generator, shrink, show triple with with `.smap` property. | ||
- `.smap(f: a -> b, g: b -> a, newShow: (b -> string)?): arbitrary b` | ||
@@ -29,0 +25,0 @@ |
@@ -51,4 +51,4 @@ /* @flow weak */ | ||
assert(typeof generator === "function", "generator should be a function"); | ||
assert(typeof generator.map === "function", "generator.map should be a function"); | ||
assert(typeof generator.flatmap === "function", "generator.flatmap should be a function"); | ||
assert(generator.map === generatorProtoMap, "generator.map should be a function"); | ||
assert(generator.flatmap === generatorProtoFlatMap, "generator.flatmap should be a function"); | ||
} | ||
@@ -55,0 +55,0 @@ |
@@ -98,2 +98,3 @@ /* @flow weak */ | ||
var arbitrary = require("./arbitrary.js"); | ||
var bless = require("./bless.js"); | ||
var either = require("./either.js"); | ||
@@ -357,2 +358,12 @@ var environment = require("./environment.js"); | ||
/** | ||
- `compile(desc: string, env: typeEnv?): arbitrary a` | ||
Compile the type describiption in provided type environment, or default one. | ||
*/ | ||
function compile(str, env) { | ||
env = env ? utils.merge(environment, env) : environment; | ||
return typify.parseTypify(env, str); | ||
} | ||
/** | ||
- `sampler(arb: arbitrary a, genSize: nat = 10): (sampleSize: nat?) -> a` | ||
@@ -405,2 +416,3 @@ | ||
/// include ./arbitraryBless.js | ||
/// include ./bless.js | ||
/// include ./primitive.js | ||
@@ -434,7 +446,7 @@ /// include ./arbitrary.js | ||
// compile | ||
compile: function (str, env) { | ||
env = env ? utils.merge(environment, env) : environment; | ||
return typify.parseTypify(env, str); | ||
}, | ||
compile: compile, | ||
// bless | ||
bless: bless, | ||
// internal utility lib | ||
@@ -441,0 +453,0 @@ random: random, |
{ | ||
"name": "jsverify", | ||
"description": "Property-based testing for JavaScript.", | ||
"version": "0.6.0-alpha.1", | ||
"version": "0.6.0-alpha.2", | ||
"homepage": "http://jsverify.github.io/", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -126,2 +126,6 @@ # JSVerify | ||
- `compile(desc: string, env: typeEnv?): arbitrary a` | ||
Compile the type describiption in provided type environment, or default one. | ||
- `sampler(arb: arbitrary a, genSize: nat = 10): (sampleSize: nat?) -> a` | ||
@@ -170,6 +174,2 @@ | ||
- `arb.bless({...}): arbitrary a` | ||
Bless generator, shrink, show triple with with `.smap` property. | ||
- `.smap(f: a -> b, g: b -> a, newShow: (b -> string)?): arbitrary b` | ||
@@ -187,2 +187,20 @@ | ||
- `bless(arb: {...}): arbitrary a` | ||
Bless almost arbitrary structure to be proper arbitrary. *Note*: this function mutates argument. | ||
Example: | ||
```js | ||
var arbTokens = jsc.bless({ | ||
generator: function () { | ||
switch (jsc.random(0, 2)) { | ||
case 0: return "foo"; | ||
case 1: return "bar"; | ||
case 2: return "quux"; | ||
} | ||
} | ||
}); | ||
``` | ||
### Primitive arbitraries | ||
@@ -456,2 +474,4 @@ | ||
- **0.6.0-alpha.2** — *2015-04-24* — jsc.bless | ||
- Added `jsc.bless` | ||
- **0.6.0-alpha.1** — *2015-04-22* — Preview | ||
@@ -458,0 +478,0 @@ - Using lazy sequences for shrink results |
Sorry, the diff of this file is too big to display
191217
33
5351
636