Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
F# Forth Batchfile Shell
Failed to load latest commit information.
.nuget get net45 tests running Oct 9, 2015
Unquote.Net40 increment version numbers for 3.1.2 release Aug 6, 2016
Unquote.Profile259 increment version numbers for 3.1.2 release Aug 6, 2016
Unquote Fix Expecto reference Dec 13, 2016
UnquoteTests.Net40 disable warnings about expected 'unit' return type in test projects t… Aug 6, 2016
UnquoteTests.Profile259 disable warnings about expected 'unit' return type in test projects t… Aug 6, 2016
UnquoteTests disable warnings about expected 'unit' return type in test projects t… Aug 6, 2016
VerifyExpectoSupport Add new project VerifyExpectoSupport Dec 12, 2016
VerifyFuchuSupport Issue 107 fuchu integration Mar 16, 2015
VerifyMbUnitV3Support No commit message Mar 15, 2015
VerifyNonFrameworkSupport merge vs2013 branch into trunk (no turning back now): net45 and profi… Mar 13, 2015
VerifyNunit3Support Fixes #120: fix typo so we use Assert.Fail instead of Assert.True wit… Jan 10, 2016
VerifyNunitSupport merge vs2013 branch into trunk (no turning back now): net45 and profi… Mar 13, 2015
VerifyXunit1Support refactor output impl Mar 16, 2015
VerifyXunit2Support update xunit.net to final 2.0.0 releases (good timing!) Apr 13, 2015
tools force add dlls Apr 20, 2015
.gitignore add .gitignore file Jan 18, 2016
LICENSE copyright info Sep 17, 2012
NOTICE update vs2010 project version and copyright years Jan 11, 2016
README.md Update README.md Mar 22, 2016
Unquote.nuspec update nuspec with github and swensensoftware urls instead of old goo… Oct 11, 2015
Unquote.sln do no build VerifyExpectoSupport as part of Release target Jan 5, 2017
Unquote.v10.sln No commit message Mar 14, 2015
build-deb.sh add simple debian build script. currently just builds net45 dll Oct 9, 2015
build.bat update build.bat w/ new files Mar 24, 2015
build.sh building net45 in sh script Jun 16, 2014
logo.png add logo.png (silly logo for googlecode site) Feb 13, 2011
run-mono-tests.sh get net45 tests running Oct 9, 2015


User Guide | Downloads | Release Notes | Issues

Unquote is not just another DSL or API for making unit test assertions. Instead, assertions are written as plain, statically-checked F# quoted expressions and test failure messages are given as step-by-step F# expression evaluations.

Unquote integrates configuration-free with all exception-based unit testing frameworks including xUnit.net, NUnit, MbUnit, Fuchu, and MSTest. For example, the following failing xUnit.net test

let ``demo Unquote xUnit support`` () =
    test <@ ([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0] @>

produces the following failure message

Test 'Module.demo Unquote xUnit support' failed: 

([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0]
[4; 3; 2; 1] = [4..1]
[4; 3; 2; 1] = []

    C:\File.fs(28,0): at Module.demo Unquote xUnit support()

Unquote may even be used within FSI sessions, enabling the direct migration of ad-hoc FSI tests during interactive development to formal test suites.

In addition to test : Quotations.Expr<bool> -> unit used for performing most assertions, Unquote has convenience operators =!, >!, <!, >=!, <=!, and <>! for performing simple comparison assertions. And finally, Unquote has operators raises<'a when 'a :> exn> : Quotations.Expr -> unit and raisesWith : Expr -> (#exn -> Expr<bool>) -> unit for asserting whether a quoted expression raises an expected exception.

At the heart of Unquote, are (public) operators for decompiling, evaluating, and incrementally reducing F# Quotations. Unquote can decompile many F# quoted expressions as single line, non-light syntax strings. See Decompiler Features for a list of notable decompiler features.

The incremental evaluator performs reduction steps until a non-reducible expression is reached. During a reduction step, an expression will be reduced if all of its subexpressions are already reduced, recursively reducing the sub-expressions otherwise. Hence order of evaluation is not strictly adhered to, but shouldn't be a problem in practice since assertion expressions are not expected to depend on order of evaluation side effects. Except for sequential expressions, which are evaluated from left to right, and control structures and boolean operator expressions, which follow valid branch paths and short-circuiting rules. If a test expression throws an exception, the test will fail and print each reduction step up to the point of the exception, and then print the exception.

As of version 2.0.0, reduction no longer depends on the F# Power Pack expression evaluator and instead uses a new custom reflection-based evaluator. The Unquote evaluator can be up to 50 times faster than the PowerPack evaluator, and was able to increase the execution speed of Unquote's own suite of 400+ self-hosted unit tests by about 4 times. It also supports more quotation expressions than PowerPack, such as variable, property, and field set expressions, loop expressions, and nested quotation expressions.

Please see the Wiki page GettingStarted for a simple guide to getting started with Unquote.

Unquote was inspired by Groovy Power Asserts.

Build status

You are welcome to Pay What You Want for Unquote via PayPal.

Copyright 2011-2016 Swensen Software