Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zardoz89 committed Jul 3, 2021
2 parents 2d918e0 + 2650c04 commit 3b2c91d
Show file tree
Hide file tree
Showing 14 changed files with 2,120 additions and 258 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ charset = utf-8

[*.d]
dfmt_split_operator_at_line_end = true
dfmt_brace_style = otbs
dfmt_template_constraint_style = always_newline

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.1.0

* Experimental @nogc support thanks to mir-algorithm and dip1008
* Fix some hidden bug with should.exist() with pointers
* Improved output message. Now shows that type of the expected and tests values.

# v1.0.1

* Pijamas now supports DLang frontend 2.086
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ dub.json:

And import pijamas where you nee it.

## NoGC mode

Pijamas haves a experimental support of nogc exceptions (thanks to mir-algorithm). This allow to use Pijamas on @nogc unittest blocks. Howeverm not the whole API it's allowed to be used on this way. For example, should.match(), depends on std.regex and isn't @nogc compatible.

To use this @nogc mode, simply use dub's subConfigurations to call the "nogc" configuration, and togle `dip1008`. However, remeber that your unit-tests would have the mir-algorithm as indirect dependency.

dub.json:
```json
"subConfigurations": {
"pijamas": "nogc"
}
```

### General Assertions

Expand Down Expand Up @@ -161,6 +173,9 @@ value.
[1, 2, 3, 4].should.include(3);
"something".should.not.include('o');
"something".should.include("th");
Note that not works with associative arrays on @nogc code.
Note that not works finding a substring of a string on @nogc code.
```

#### `U length(U)(U length, string file = __FILE__, size_t line = __LINE__);`
Expand Down Expand Up @@ -192,6 +207,7 @@ Asserts for a string wrapped around the Assertion to match a regular expression.
"1234numbers".should.match(`[0-9]+[a-z]+`);
"1234numbers".should.not.match(`^[a-z]+`);
```
Note that not works on @nogc code.

#### `bool True(string file = __FILE__, size_t = line = __LINE__);` and `.False`

Expand All @@ -211,6 +227,7 @@ Asserts whether a forward range is sorted.
[1, 2, 3, 4].should.be.sorted;
[1, 2, 0, 4].should.not.be.sorted;
```
Note that not works on @nogc code.

#### `void key(U)(U other, string file = __FILE__, size_t line = __LINE__);`

Expand Down
6 changes: 3 additions & 3 deletions docs/_data/menus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ menu:
- url: changelog.html
name: changelog.md
title: Changelog
- url: pijamas.html
name: pijamas.html
title: Documentation
- url: assertion.html
name: assertion.html
title: API Documentation
62 changes: 47 additions & 15 deletions docs/pijamas.html → docs/assertion.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="UTF-8">
<title>pijamas</title>
<title>pijamas.assertion</title>
<style type="text/css" media="screen">
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, address, cite, code, del, dfn, em, figure,
Expand Down Expand Up @@ -508,18 +508,11 @@
<body id="ddoc_main" class="ddoc dlang">
<div class="content_wrapper">
<article class="module">
<h1 class="module_name">pijamas</h1>
<h1 class="module_name">pijamas.assertion</h1>
<section id="module_content"><section class="section ddoc_sections">
<div class="ddoc_summary">
<p class="para">
Pijamas, a BDD assertion library for D.

</p>
</div>
<div class="ddoc_authors">
<h4>Authors</h4>
<p class="para">
Pedro Tacla Yamada, Luis Panadero Guardeño
Pijamas, a BDD <code class="code">assertion</code> library for D.

</p>
</div>
Expand Down Expand Up @@ -558,8 +551,43 @@ <h4>Declaration</h4>
<section class="section ddoc_sections">
<div class="ddoc_summary">
<p class="para">
Pijamas exports a single function <code class="code">should</code> meant for public use. Because of D’s lookup shortcut syntax, one is able
to use both <code class="code">should</code>(obj) and obj.<code class="code">should</code> to get an object wrapped around an Assertion instance
The function <strong><code class="code">should</code></strong> it's an helper or syntax sugar to create the assertation.
Because of D’s lookup shortcut syntax, one is able to use both <code class="code"><code class="code">should</code>(obj)</code> and <code class="code">obj.<code class="code">should</code></code> to
get an object wrapped around an Assertion instance
</p>
</div>

</section>

</div>

</li><li class="ddoc_member">
<div class="ddoc_member_header">
<div class="ddoc_header_anchor">
<a href="#expect" id="expect"><code class="code">expect</code></a>
</div>
</div><div class="ddoc_decl">
<section class="section">
<div class="declaration">
<h4>Declaration</h4>
<div class="dlang">
<p class="para">
<code class="code">
<span class="ddoc_anchor" id="expect"></span>alias <code class="code">expect</code> = should(T)(auto ref T context);

</code>
</p>
</div>
</div>
</section>
</div>
<div class="ddoc_decl">
<section class="section ddoc_sections">
<div class="ddoc_summary">
<p class="para">
The function <strong><code class="code">expect</code></strong> it's an helper or syntax sugar to create the assertation.
Because of D’s lookup shortcut syntax, one is able to use both <code class="code"><code class="code">expect</code>(obj)</code> and <code class="code">obj.<code class="code">expect</code></code> to
get an object wrapped around an Assertion instance
</p>
</div>

Expand All @@ -579,7 +607,7 @@ <h4>Declaration</h4>
<div class="dlang">
<p class="para">
<code class="code">
<span class="ddoc_anchor" id="Assertion"></span>class <code class="code">Assertion</code>(T);
<span class="ddoc_anchor" id="Assertion"></span>struct <code class="code">Assertion</code>(T);

</code>
</p>
Expand Down Expand Up @@ -645,6 +673,8 @@ <h4>Declaration</h4>
<code class="code">
<span class="ddoc_anchor" id="Assertion.be"></span>alias <code class="code">be</code> = id;
<br>
<span class="ddoc_anchor" id="Assertion.to"></span>alias <code class="code">to</code> = id;
<br>
<span class="ddoc_anchor" id="Assertion.as"></span>alias <code class="code">as</code> = id;
<br>
<span class="ddoc_anchor" id="Assertion.of"></span>alias <code class="code">of</code> = id;
Expand Down Expand Up @@ -739,7 +769,7 @@ <h4>Declaration</h4>
<div class="dlang">
<p class="para">
<code class="code">
<span class="ddoc_anchor" id="Assertion.equal"></span>@trusted T <code class="code">equal</code>(U)(U <code class="code">other</code>, string <code class="code">file</code> = __FILE__, size_t <code class="code">line</code> = __LINE__);
<span class="ddoc_anchor" id="Assertion.equal"></span>@trusted T <code class="code">equal</code>(U)(auto ref U <code class="code">other</code>, string <code class="code">file</code> = __FILE__, size_t <code class="code">line</code> = __LINE__);

</code>
</p>
Expand Down Expand Up @@ -1332,7 +1362,9 @@ <h4>Declaration</h4>
<div class="dlang">
<p class="para">
<code class="code">
<span class="ddoc_anchor" id="Assertion.include"></span>@trusted U <code class="code">include</code>(U)(U <code class="code">other</code>, string <code class="code">file</code> = __FILE__, size_t <code class="code">line</code> = __LINE__);
<span class="ddoc_anchor" id="Assertion.include"></span>@nogc @trusted U <code class="code">include</code>(U)(U <code class="code">other</code>, string <code class="code">file</code> = __FILE__, size_t <code class="code">line</code> = __LINE__) if (!isAssociativeArray!T);
<br>
@trusted U <code class="code">include</code>(U)(U <code class="code">other</code>, string <code class="code">file</code> = __FILE__, size_t <code class="code">line</code> = __LINE__) if (isAssociativeArray!T);
<br>
<span class="ddoc_anchor" id="Assertion.value"></span>alias <code class="code">value</code> = include;
<br>
Expand Down
10 changes: 8 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
layout: default
title: Changelog
---
# v1.1.0

* Experimental @nogc support thanks to mir-algorithm and dip1008
* Fix some hidden bug with should.exist() with pointers
* Improved output message. Now shows that type of the expected and tests values.

# v1.0.1

* Pijamas now supports DLang frontend 2.086
Expand All @@ -11,8 +17,8 @@ title: Changelog
* Moved unit-tests to an separate foolder to avoid pollute other projects with
Pijamas unit-testing dependencies.
* Launch tests using silly, unit-threaded, trial and dunit.
* Assertions now throws AssertException that it's an alias to AssertError or to
unit-threaded UnitTestException;
* Assertions now throws AssertException that extends from Exception or to
unit-threaded UnitTestException
* Added expect and .to()
* Now Assertion is a struct

Expand Down
Loading

0 comments on commit 3b2c91d

Please sign in to comment.