• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rokucommunity / brs / #84

04 Apr 2024 10:25PM UTC coverage: 89.562% (-0.07%) from 89.636%
#84

push

web-flow
Implement `ifArraySizeInfo` in `roArray` (#62)

* Implemented `ifArraySizeInfo` in `roArray`

* Removing empty line

* Fixed warning message

2024 of 2438 branches covered (83.02%)

Branch coverage included in aggregate %.

92 of 108 new or added lines in 7 files covered. (85.19%)

45 existing lines in 4 files now uncovered.

5801 of 6299 relevant lines covered (92.09%)

29750.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.45
/src/stdlib/CreateObject.ts
1
import {
134✔
2
    Callable,
3
    ValueKind,
4
    BrsInvalid,
5
    BrsString,
6
    BrsType,
7
    StdlibArgument,
8
    RoAssociativeArray,
9
} from "../brsTypes";
10
import { BrsObjects } from "../brsTypes/components/BrsObjects";
134✔
11
import { Interpreter } from "../interpreter";
12
import { MockNode } from "../extensions/MockNode";
134✔
13

14
/** Creates a new instance of a given brightscript component (e.g. roAssociativeArray) */
15
export const CreateObject = new Callable("CreateObject", {
134✔
16
    signature: {
17
        args: [
18
            new StdlibArgument("objName", ValueKind.String),
19
            new StdlibArgument("arg1", ValueKind.Dynamic, BrsInvalid.Instance),
20
            new StdlibArgument("arg2", ValueKind.Dynamic, BrsInvalid.Instance),
21
            new StdlibArgument("arg3", ValueKind.Dynamic, BrsInvalid.Instance),
22
            new StdlibArgument("arg4", ValueKind.Dynamic, BrsInvalid.Instance),
23
            new StdlibArgument("arg5", ValueKind.Dynamic, BrsInvalid.Instance),
24
        ],
25
        returns: ValueKind.Dynamic,
26
    },
27
    impl: (interpreter: Interpreter, objName: BrsString, ...additionalArgs: BrsType[]) => {
28
        let objToMock = objName.value.toLowerCase();
134✔
29

30
        if (
134✔
31
            objToMock === "rosgnode" &&
324✔
32
            additionalArgs[0] &&
33
            !(additionalArgs[0] instanceof BrsInvalid)
34
        ) {
35
            objToMock = additionalArgs[0].toString();
95✔
36
        }
37

38
        let possibleMock = interpreter.environment.getMockObject(objToMock.toLowerCase());
134✔
39
        if (possibleMock instanceof RoAssociativeArray) {
134✔
40
            return new MockNode(possibleMock, objToMock);
9✔
41
        }
42
        let ctor = BrsObjects.get(objName.value.toLowerCase());
125✔
43

44
        if (ctor) {
125✔
45
            try {
124✔
46
                return ctor(interpreter, ...additionalArgs);
124✔
47
            } catch (err: any) {
NEW
UNCOV
48
                interpreter.stderr.write(`${err.message} ${interpreter.formatLocation()}\n`);
×
49
            }
50
        }
51
        return BrsInvalid.Instance;
1✔
52
    },
53
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc