Versions Compared
compared with
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
equal( expectedactual, actualexpected, message ); |
Parameters
Parameter | Type | Mandatory | Notes | API Version |
---|---|---|---|---|
expectedactual | Variant | The expected actual value. | 1.0 | |
actualexpected | Variant | The actual expected value. | 1.0 | |
message | String | A message stating what the assertion is testing. | 1.0 |
Return Values
Value | Type | Notes | API Version |
---|---|---|---|
<error> | Error | Most likely the parameters are wrong. | 1.0 |
true | Boolean | expected == actual. | 1.0 |
false | Boolean | expected != actual. | 1.0 |
Example
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Test APITopics:
|