Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Excerpt

A basic equality checking assertion...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
equal( expectedactual, actualexpected, message );

Parameters

ParameterTypeMandatoryNotesAPI Version
expectedactualVariant(tick)The expected actual value.1.0
actualexpectedVariant(tick)The actual expected value.1.0
messageString(tick)A message stating what the assertion is testing.1.0

Return Values

ValueTypeNotesAPI Version
<error>ErrorMost likely the parameters are wrong.1.0
trueBooleanexpected == actual.1.0
falseBooleanexpected != actual.1.0

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
Test("Inequality checks", Test.ANY( ), function(_global, settings) {
	// assertions will pass
	equal( true, true, "true == true?" );
	equal( undefined, null, "undefined == null?" );
	equal( null, false, "null == false?" );
	equal( "fish", true, "'fish' == true?" );
	// assertion will fail
	equal( true, false, "true == false?" );
	// and for some fun... NaN != NaN, ever!
	equal( NaN, NaN, "NaN == NaN?" ); // WAT?!
	// https://www.destroyallsoftware.com/talks/wat
	// https://coderwall.com/p/sekogw
});
Div
classbox
Availability
Status
colourGreen
titleStable

Requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

Test API

Topics:

Child pages (Children Display)
alltrue
depthall
pageTest API
excerpttrue