Skip to content

Commit

Permalink
chore(docs): add docs for _brs_.testData (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasya-M authored May 18, 2021
1 parent 9307810 commit a447916
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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

0 comments on commit a447916

Please sign in to comment.