Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #76 add cleaning testData before running each test file. #88

Merged
merged 8 commits into from
May 18, 2021
1 change: 1 addition & 0 deletions docs/api/reference/globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ These extensions are all available on a global associative array called `_brs_`:
{
getStackTrace: function,
global: associative array,
testData: associative array,
mockComponent: function,
mockComponentPartial: function,
mockFunction: function,
Expand Down
20 changes: 20 additions & 0 deletions docs/api/reference/test-utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ print _brs_.global

------------

## \_brs_.testData

A reference to the temporary associative array, so that you can access it from everywhere inside your brs code. Mostly used for saving/accessing some test-specific data. Clears before running each test file.

### Usage
```brightscript
_brs_.testData._isFooAvailable = false
_brs_.mockFunction("isFooAvailable", sub()
return _brs_.testData._isFooAvailable
end sub)

isFooAvailable() ' => false

_brs_.testData._isFooAvailable = true ' something happened and now it is available
isFooAvailable() ' => true
```
<br/>

------------

# \_brs_.process

Allows you to access the command line arguments and locale.
Expand Down