From 9609978b886b6b1b160f2b6da885ef6426b38a44 Mon Sep 17 00:00:00 2001 From: Grzegorz Dziadkiewicz Date: Mon, 25 Jul 2016 11:02:36 +0200 Subject: [PATCH] * Fix documentation link * Move remaining tests from FactCheck to BaseTestNext --- README.md | 2 +- test/REQUIRE | 3 +-- test/runtests.jl | 1 - test/utils.jl | 29 ++++++++++++++++------------- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index ef210fe..bc03863 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ julia> bar(1, 2, 3) ``` Plays well with macros. See -[ValueDispatch.jl](https://github.com/zachallaun/ValueDispatch.jl/blob/master/src/ValueDispatch.jl) +[ValueDispatch.jl](https://github.com/gdziadkiewicz/ValueDispatch.jl) for another example. ### Low-level utilities diff --git a/test/REQUIRE b/test/REQUIRE index 806c506..7d7d339 100644 --- a/test/REQUIRE +++ b/test/REQUIRE @@ -1,2 +1 @@ -FactCheck -BaseTestNext +BaseTestNext \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index eca30d3..1a636d9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,6 @@ if VERSION < v"0.5.0-dev" else using Base.Test end -using FactCheck using ExpressionUtils include("functions.jl") diff --git a/test/utils.jl b/test/utils.jl index af1d38e..7a16f99 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -1,10 +1,10 @@ -facts("Expression destructuring") do +@testset "Expression destructuring" begin - context("expr_bindings") do + @testset "expr_bindings" begin - @fact expr_bindings(:(x = 5), :(x = _val_)) --> Dict(:_val_ => 5) - @fact expr_bindings(:(x = 5), :(_sym_ = 5)) --> Dict(:_sym_ => :x) - @fact expr_bindings(:(x = 5), :_ex_) --> Dict(:_ex_ => :(x = 5)) + @test expr_bindings(:(x = 5), :(x = _val_)) == Dict(:_val_ => 5) + @test expr_bindings(:(x = 5), :(_sym_ = 5)) == Dict(:_sym_ => :x) + @test expr_bindings(:(x = 5), :_ex_) == Dict(:_ex_ => :(x = 5)) splatex = Expr(:let, :_body_, :_SPLAT_bindings_) ex = :(let x=1, y=2, z=3 @@ -13,14 +13,16 @@ facts("Expression destructuring") do end) bindings = expr_bindings(ex, splatex) + body = bindings[:_body_] + b = bindings[:_bindings_] - @fact haskey(bindings, :_body_) --> true - @fact haskey(bindings, :_bindings_) --> true - @fact bindings[:_body_] --> body -> isa(body, Expr) && body.head == :block - @fact bindings[:_bindings_] --> b -> isa(b, Array) && length(b) == 3 + @test haskey(bindings, :_body_) + @test haskey(bindings, :_bindings_) + @test isa(body, Expr) && body.head == :block + @test isa(b, Array) && length(b) == 3 end - context("expr_replace") do + @testset "expr_replace" begin ex = quote let x, y, z @@ -45,9 +47,10 @@ facts("Expression destructuring") do foofun = expr_replace(ex, template, out) eval(foofun) - @fact foofun.head --> :function - @fact eval(foofun)(1,2,3) --> 5 - @fact bar(1,2,3) --> 5 + + @test foofun.head == :function + @test eval(foofun)(1,2,3) == 5 + @test bar(1,2,3) == 5 end end