Giter Site home page Giter Site logo

sunit-assertions-extra's Introduction

SUnit extra assertions

These are assertions (or matchers) for SUnit written for cuis Smalltalk inspired by some of the marchers of RSpec.

How to use it

Just import it, these matchers extends TestCase.

Current list of assertions

An action changes something

self assert: [ aCollection add: 1 ] changes: [ aCollection size ]

Also the opposite is included:

self assert: [ aCollection sum ] doesNotChange: [ aCollection size ]

And the parametric versions:

self assert: [ aCollection add: 1; add: 2 ] changes: [ aCollection size ] by: 2

aCollection := OrderedCollection with: 1.
self assert: [ aCollection add: 2 ] changes: [ aCollection size ] from: 1 to: 2

A float number is equal to another float number with a precision value

self assert: (0.3) isNearTo: (0.1 + 0.2)

self assert: originalNumber isNearTo: newValue withPrecision: precision

Also you have the negative assertions:

self assert: originalNumber isNotNearTo: newValue

self assert: originalNumber isNotNearTo: newValue withPrecision: precision

A collection includes an element

self assert: #() includes: 1

Will raise a nice error message

sunit-assertions-extra's People

Contributors

gstn-caruso avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sunit-assertions-extra's Issues

Add assertions

Contains exactly

self assert: aCollection containsExactly: [element1, element2]

dynamic assertions

These assertions are the ones I love from Rspec. It allows you to use domain language in your assertions. Rspec takes advantage of conventions like ? or has_***? for booleans.

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.