Skip to content

Improve input files #600

@niknetniko

Description

@niknetniko

There are three scenario's that fall under "input files":

  • stdin is used with a file, e.g. command < some_file
  • expressions and statements use file names, e.g. some_expression('file.txt')
  • A file is generally available

stdin

Currently, stdin only allows inline content. This can be expanded to also allow using files (see #479).

stdin:
   path: 'test.txt'
   content: 'file'

This would create a file test.txt at runtime in the workdir and redirect it to the stdin:

./submission < test.txt

Other combinations are also possible, like only content (same as current, inline), or content with !path.

expressions / statements

Here, files are taken from input_files, an array of files. These will also be passed to Dodona for replacement in the text.
In this case, path is required.

If no input uses a file, it will be added as a message.

tabs:
- tab: counting
  contexts:
  - testcases:
    - expression: count_words('fish.txt', 'sharks')
      return: 1
      input_files:
        - path: "fish.txt"
          content: "There are sharks in the water!"
        - path: "mammal.txt"
          content: "There are tigers in the water!"

A path must ALWAYS be provided. This is the string that will be shown to the student in the above expression. The path field (originally called name) contains relative path names and is relative to the workdir directory.

Again, more combinations are possible.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions