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

rokucommunity / brs / #299

01 Apr 2024 08:41PM UTC coverage: 90.321% (-0.1%) from 90.465%
#299

push

web-flow
Implemented `roPath` component and fixed Interpreter Comparisons (#50)

* Added option to disable colors and fixed unit tests to not fail with colors

* Implemented `roPath` and fixed comparison to match Roku behavior

* Added unit tests and fixed prettier issues

* Properly compare Number with Boolean

* Added support to AND and OR between Boolean and Numbers

* Updated unit tests and fixed Int64

* Improved URL regex for CLI colorizer

1881 of 2239 branches covered (84.01%)

Branch coverage included in aggregate %.

167 of 181 new or added lines in 11 files covered. (92.27%)

5 existing lines in 3 files now uncovered.

5519 of 5954 relevant lines covered (92.69%)

8637.25 hits per line

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

88.89
/src/brsTypes/components/BrsComponent.ts
1
import { BrsType } from "..";
2
import { BrsInvalid, ValueKind, BrsValue } from "../BrsType";
3
import { Callable } from "../Callable";
4
import { BrsInterface } from "../BrsInterface";
141✔
5

6
export class BrsComponent {
141✔
7
    private methods: Map<string, Callable> = new Map<string, Callable>();
15,477✔
8
    private readonly componentName: string;
9

10
    readonly interfaces = new Map<string, BrsInterface>();
15,477✔
11

12
    constructor(name: string) {
13
        this.componentName = name;
15,477✔
14
    }
15

16
    /**
17
     * Returns the name of the component, used to create instances via `createObject`.
18
     * @returns the name of this component.
19
     */
20
    getComponentName(): string {
21
        return this.componentName;
169✔
22
    }
23

24
    hasInterface(interfaceName: string) {
NEW
25
        return this.interfaces.has(interfaceName.toLowerCase());
×
26
    }
27

28
    protected registerMethods(interfaces: Record<string, Callable[]>) {
29
        Object.entries(interfaces).forEach(([interfaceName, methods]) => {
15,410✔
30
            let interfaceKey = interfaceName.toLowerCase();
41,086✔
31
            if (!this.interfaces.has(interfaceKey)) {
41,086✔
32
                this.interfaces.set(interfaceKey, new BrsInterface(interfaceName, methods));
41,026✔
33
            }
34

35
            this.appendMethods(methods);
41,086✔
36
        });
37
    }
38

39
    /** Appends a method to the component. */
40
    appendMethod(index: string, method: Callable) {
41
        this.methods.set(index.toLowerCase(), method);
6✔
42
    }
43

44
    /** Given a list of methods, appends all of them to the component. */
45
    appendMethods(methods: Callable[]) {
46
        methods.forEach((m) => this.methods.set((m.name || "").toLowerCase(), m));
269,927!
47
    }
48

49
    getMethod(index: string): Callable | undefined {
50
        return this.methods.get(index.toLowerCase());
1,965✔
51
    }
52
}
53

54
/** Represents a BrightScript component that has elements that can be iterated across. */
55
export interface BrsIterable {
56
    /**
57
     * Returns the set of iterable elements contained in this component.
58
     * @returns an array of elements contained in this component.
59
     */
60
    getElements(): ReadonlyArray<BrsType>;
61

62
    /**
63
     * Retrieves an element from this component at the provided `index`.
64
     * @param index the index in this component from which to retrieve the desired element.
65
     * @param isCaseSensitive determinate whether operation of getting should be case sensitive or not.
66
     * @returns the element at `index` if one exists, otherwise throws an Error.
67
     */
68
    get(index: BrsType, isCaseSensitive?: boolean): BrsType;
69

70
    set(index: BrsType, value: BrsType, isCaseSensitive?: boolean): BrsInvalid;
71
}
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