Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zardoz89 committed Jun 6, 2021
2 parents 92be10f + a10610e commit 2d918e0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
- windows-latest
dc:
- dmd-latest
- dmd-2.091.1
- dmd-2.086.1
- ldc-latest
exclude:
- { os: macOS-latest, dc: dmd-2.091.1 }
- { os: macOS-latest, dc: dmd-2.086.1 }

runs-on: ${{ matrix.os }}

Expand All @@ -36,21 +36,29 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2

- name: 'Build & Test'
- name: 'Build'
run: |
# Release build
dub build --parallel -b release
dub clean --all-packages -q
# Run tests
dub test --root=tests/silly --parallel --coverage
- name: 'Test with unit-threaded'
if: matrix.dc != 'dmd-2.086.1' && runner.os != 'windows'
run:
dub test --root=tests/unit-threaded --parallel --coverage
- name: 'Test with silly'
if: matrix.dc != 'dmd-2.086.1'
run:
dub test --root=tests/silly --parallel --coverage
- name: 'Test with d-unit'
run:
dub test --root=tests/d-unit --parallel
- name: 'Launch tests with Trial'
if: runner.os == 'Linux'
- name: 'Tests with Trial'
if: runner.os == 'Linux' && matrix.dc != 'dmd-2.086.1'
run:
dub run trial:runner@~master

- name: Upload Coverage to Codecov
# Upload test coverage
if: runner.os == 'Linux'
if: github.ref == 'refs/heads/master' && runner.os == 'Linux' && matrix.dc == 'dmd-latest'
run: bash <(curl -s https://codecov.io/bash)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.0.1

* Pijamas now supports DLang frontend 2.086

# v1.0.0

* Moved unit-tests to an separate foolder to avoid pollute other projects with
Expand Down
7 changes: 6 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
layout: default
title: Changelog
---
# v1.0.1

* Pijamas now supports DLang frontend 2.086

# v1.0.0

* 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;

* Added expect and .to()
* Now Assertion is a struct

# v0.3.5

Expand Down
4 changes: 2 additions & 2 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
},
"toolchainRequirements": {
"dub": ">=1.20.0",
"frontend": ">=2.091"
"dub": ">=1.14.0",
"frontend": ">=2.086"
}
}
13 changes: 9 additions & 4 deletions source/pijamas/assertion.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import std.traits : hasMember, isSomeString, isCallable, isAssociativeArray,
import pijamas.exception;

/**
* The function **should** it's an helper or syntax sugar to create the assertation.
* The function **should** it's an helper or syntax sugar to create the assertation.
* Because of D’s lookup shortcut syntax, one is able to use both `should(obj)` and `obj.should` to
* get an object wrapped around an Assertion instance
*/
Expand All @@ -25,7 +25,7 @@ public Assertion!T should(T)(auto ref T context)
}

/**
* The function **expect** it's an helper or syntax sugar to create the assertation.
* The function **expect** it's an helper or syntax sugar to create the assertation.
* Because of D’s lookup shortcut syntax, one is able to use both `expect(obj)` and `obj.expect` to
* get an object wrapped around an Assertion instance
*/
Expand Down Expand Up @@ -193,9 +193,14 @@ struct Assertion(T)
string file = __FILE__, size_t line = __LINE__) @trusted
if (is(T : real) && __traits(isFloating, T) && is(U : real) && __traits(isFloating, U))
{
import std.math : isClose;
operator = "be approximated equal than";
this.ok(isClose(context, other, maxRelDiff, maxAbsDiff), other, file, line);
static if (__traits(compiles, { import std.math : isClose; })) {
import std.math : isClose;
this.ok(isClose(context, other, maxRelDiff, maxAbsDiff), other, file, line);
} else {
import std.math : approxEqual;
this.ok(approxEqual(context, other, maxRelDiff, maxAbsDiff), other, file, line);
}
return context;
}

Expand Down

0 comments on commit 2d918e0

Please sign in to comment.