# `nupp.test` Assertions shared by Nupp's bundled test runner and project test suites. Every failure names the values that differed. The functions return their successful input where that is useful, so an assertion may narrow or validate a value without forcing the caller to spell it twice. ## Functions ### `assert` _function_ ```nupp function assert(value: any, ...: any): any ``` Requires a truthy value and returns its complete input pack. #### Arguments | Name | Type | Description | | --- | --- | --- | | `value` | `any` | | | `...` | `any` | | #### Returns | Type | Description | | --- | --- | | `any` | | #### Raises - when value is false or nil ### `equal` _function_ ```nupp function equal(actual: any, expected: any, message: string?): any ``` Requires two values to be equal and returns the actual value. #### Arguments | Name | Type | Description | | --- | --- | --- | | `actual` | `any` | | | `expected` | `any` | | | `message` | `string?` | | #### Returns | Type | Description | | --- | --- | | `any` | | #### Raises - when actual and expected differ ### `isSkip` _function_ ```nupp function isSkip(value: any): boolean ``` Answers whether a caught error is a skip raised by this module. #### Arguments | Name | Type | Description | | --- | --- | --- | | `value` | `any` | | #### Returns | Type | Description | | --- | --- | | `boolean` | | ### `matches` _function_ ```nupp function matches(value: any, pattern: string, message: string?): string ``` Requires a string value containing a Lua pattern and returns the string. #### Arguments | Name | Type | Description | | --- | --- | --- | | `value` | `any` | | | `pattern` | `string` | | | `message` | `string?` | | #### Returns | Type | Description | | --- | --- | | `string` | | #### Raises - when value is not a string or does not contain pattern ### `notEqual` _function_ ```nupp function notEqual(actual: any, unwanted: any, message: string?): any ``` Requires two values to differ and returns the actual value. #### Arguments | Name | Type | Description | | --- | --- | --- | | `actual` | `any` | | | `unwanted` | `any` | | | `message` | `string?` | | #### Returns | Type | Description | | --- | --- | | `any` | | #### Raises - when actual and unwanted are equal ### `raises` _function_ ```nupp function raises(fn: function(...: any): any, pattern: string?): any ``` Requires a callback to raise and returns its error value. #### Arguments | Name | Type | Description | | --- | --- | --- | | `fn` | `function(...: any): any` | | | `pattern` | `string?` | | #### Returns | Type | Description | | --- | --- | | `any` | | #### Raises - when the callback returns, or its error does not match pattern ### `skip` _function_ ```nupp function skip(reason: string): never ``` Skips the current test case with a reason. #### Arguments | Name | Type | Description | | --- | --- | --- | | `reason` | `string` | | #### Returns | Type | Description | | --- | --- | | `never` | | ### `skipReason` _function_ ```nupp function skipReason(value: any): string? ``` Returns the reason carried by a skip error. #### Arguments | Name | Type | Description | | --- | --- | --- | | `value` | `any` | | #### Returns | Type | Description | | --- | --- | | `string?` | |