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

feat(extensions): Add _brs_.testData associative array #646

Merged
merged 6 commits into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ export const _brs_ = new RoAssociativeArray([
{ name: new BrsString("runInScope"), value: RunInScope },
{ name: new BrsString("process"), value: Process },
{ name: new BrsString("global"), value: mGlobal },
{ name: new BrsString("testData"), value: new RoAssociativeArray([]) },
{ name: new BrsString("triggerKeyEvent"), value: triggerKeyEvent },
{ name: new BrsString("getStackTrace"), value: GetStackTrace },
]);

/** resets _brs_.testData values to `{}` in brightscript representation */
export function resetTestData() {
_brs_.set(new BrsString("testData"), new RoAssociativeArray([]));
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "./componentprocessor";
import { Parser } from "./parser";
import { Interpreter, ExecutionOptions, defaultExecutionOptions } from "./interpreter";
export { resetTestData } from "./extensions";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this needs to be exposed from the root of the module. If it does need to be exposed, I'd like for us to find (or add) a new property to put it on instead of it being a sibling of brs.lexer, brs.parser, brs.types, etc. Those are all very low-level concepts, and resetTestData doesn't match those 😃

import * as BrsError from "./Error";
import * as LexerParser from "./LexerParser";
import { CoverageCollector } from "./coverage";
Expand Down