Skip to content

Avoid prefixing variable names with namespace #594

@pdawyndt

Description

@pdawyndt

In this exercise we test the main call. Afterwards, we want to test the value of global variables. This test suite (where oracles have been removed) doesn't work

units:
- unit: "IO"
  cases:
    - script:
      - stdout: "Your roll is 1"
      - expression: "roll"
        return: 1
      - expression: "SIDES"
        return: 6

Because the variable roll is not available in the global namespace. Oddly enough the variable SIDES is available in the global namespace. We can resolve this by accessing the global variables through the submission namespace.

units:
- unit: "IO"
  cases:
    - script:
      - stdout: "Your roll is 1"
      - expression: "submission.roll"
        return: 1
      - expression: "submission.SIDES"
        return: 6

However, this exposes the submission namespace for students. This can be hidden somewhat using a description attribute, but the namespace keeps showing up in error messages and in the debugger (where it breaks the debugging session as there is not submission namespace over there).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions