Giter Club home page Giter Club logo

atticus's Introduction

Atticus

atticus is a embryonic collection of tools to help testing.

atticus.mock is a slightly different approach to mocking, where the mocked function can be implemented as an inline function to do whatever checking or return value calculation that is required.

;; pull in namespaces
    (use 'clojure.test)
    (require 'atticus.mock)

;; define test which mocks f
(deftest mock-test
      (atticus.mock/expects
        [(f [arg]
           (is (= arg 1) "Check argument")
           arg)]
    (is (= 1 (f 1)) "Call mocked function"))

At the moment there are two macros that can be used to wrap the body of the mocked function and will add verification for the number of times the mocked function is called. The once macro ensures the function is called once, and only once. The times macro, which takes an integer argument, ensures the function is called exactlyt he specified number of times.

;; define test, that should be called just once
(deftest mock-test
      (atticus.mock/expects
        [(f [arg]
           (atticus.mock/once
             (is (= arg 1) "Check argument")
             arg))]
    (is (= 1 (f 1)) "Call mocked function"))

atticus.utils contains some test helpers for accessing private vars, and for handling temporary files.

API documentation is available.

Installation

atticus is distributed as a jar, and is available in the clojars repository.

Installation is with Leiningen, maven, or your favourite maen repository aware build tool.

License

Licensed under EPL

atticus's People

Contributors

hlship avatar hugoduncan avatar

Watchers

 avatar  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.