Package detail

hamcrest

mikestead21MIT0.0.3

A library of Matchers (also known as constraints or predicates) allowing 'match' rules to be defined declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules.

javascript, library, haxe

readme

Hamcrest for Haxe

Port of hamcrest for Haxe.

Provides a library of matcher objects (also known as constraints or predicates) allowing 'match' rules to be defined declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules.

Note that hamcrest is not a testing library, it just happens that matchers are very useful for testing.

Tested against js, as3, as2, neko, cpp and php.

Installation

Install the latest release from haxelib:

haxelib install hamcrest

Or if you want to install the latest directly from github:

haxelib git hamcrest https://github.com/mikestead/hamcrest-haxe.git src

Usage

See org.hamcrest.Matchers for the complete list of Matchers available.

Examples:

import org.hamcrest.Matchers.*

assertThat([], isEmpty());
assertThat("foo", is("foo"));
assertThat("foo", startsWith("f"));
assertThat(["foo", "bar"], equalTo(["foo", "bar"]));
assertThat(["foo", "bar"], hasItems([endsWith("r")]))

changelog

2.0.1

  • #3 Update IsIterableWithSize.hx.

2.0.0

  • Add org.hamcrest.Matchers and org.hamcrest.CoreMatchers shortcut import classes.
  • Updating docs an tests.

1.2.0

  • IsEqual now performs correct equality checks on Enums.

1.1.0

  • Add support for Haxe 3.0 RC 1.

1.0.0