Giter Site home page Giter Site logo

jive.jl's Introduction

Jive ๐Ÿ‘ฃ

Documentation Build Status

Jive.jl is a Julia package to help the writing tests.

runtests

run the test files from the specific directory.

using Jive
runtests(@__DIR__, skip=[], node1=[], targets=ARGS)

runtests.svg

for the runtests.jl, ARGS are used to filter the targets and to set the start offset of the tests.

~/.julia/dev/Jive/test $ julia --color=yes runtests.jl jive/s jive/m start=3
1/5 jive/mockup/mockup.jl --
2/5 jive/skip/skip-calls.jl --
3/5 jive/skip/skip-exprs.jl
    Pass 4  (0.38 seconds)
4/5 jive/skip/skip-functions.jl
    Pass 4  (0.05 seconds)
5/5 jive/skip/skip-modules.jl
    Pass 4  (0.01 seconds)
โœ…  All 12 tests have been completed.  (0.73 seconds)

in the above example, test files are matched for only have jive/s jive/m and jumping up to the 3rd file.

Examples

  • run tests
~/.julia/dev/Jive/test $ julia --color=yes runtests.jl
  • run tests with target directory.
~/.julia/dev/Jive/test $ julia --color=yes runtests.jl jive/If
  • distributed run tests with -p
~/.julia/dev/Jive/test $ julia --color=yes -p3 runtests.jl
  • distributed run tests for Pkg.test(), using JIVE_PROCS ENV.
~/.julia/dev/Jive $ JIVE_PROCS=2 julia --color=yes --project=. -e 'using Pkg; Pkg.test()'

~/.julia/dev/Jive $ julia --color=yes --project=. -e 'ENV["JIVE_PROCS"]="2"; using Pkg; Pkg.test()'

see also travis job logs.

watch

watch the folders. You may need to install Revise.jl.

~/.julia/dev/Jive/test/Example/test $ cat runtests.jl
using Jive
runtests(@__DIR__, skip=["revise.jl"])

~/.julia/dev/Jive/test/Example/test $ cat revise.jl
using Revise, Jive
using Example
watch(@__DIR__, sources=[pathof(Example)]) do path
    @info :changed path
    revise()
    runtests(@__DIR__, skip=["revise.jl"])
end
# Jive.stop(watch)

~/.julia/dev/Jive/test/Example/test $ julia --project=.. -q -i revise.jl example
watching folders ...
  - ../src
  - example

when saving any files in the watching folders, it automatically run tests.

@skip

skip the expression.

using Jive # @skip

@skip module want_to_skip_this_module
sleep(2)
end

@skip function want_to_skip_this_function()
sleep(2)
end

@skip println(1+2)
  • Change to do not skip the code: set ENV["JIVE_SKIP"] = "0"

@onlyonce

used to run the block only once.

using Jive # @onlyonce

@onlyonce begin
    println(42)
end

@If

evaluate the module by the condition.

using Jive # @If
@If VERSION >= v"1.1.0-DEV.764" module load_some_module
end

@useinside

use inside of the module.

using Jive # @useinside
@useinside module test_pkgs_flux_optimise
# ...
end

@mockup

used to produce a replica from the other module.

using Jive # Mock @mockup
using Test

module Goods
struct Foo
end
function f(::Foo)
    10
end
function g(::Foo)
    10
end
end # module Goods


@mockup module Goods
function f(::Foo)
    20
end
end # @mockup module Goods
@test Goods.f(Goods.Foo()) == 10
@test Mock.Goods.f(Mock.Goods.Foo()) == 20
@test Mock.Goods.g(Mock.Goods.Foo()) == 10


Goods3 = @mockup module Goods
function g(::Foo)
    30
end
end # @mockup module Goods
@test Goods.f(Goods.Foo()) == 10
@test Mock.Goods.f(Mock.Goods.Foo()) == 10
@test Mock.Goods.g(Mock.Goods.Foo()) == 30
@test Goods3 isa Module
@test Goods3.g === Mock.Goods.g

jive.jl's People

Contributors

wookay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.