Skip to content

InlineExpectationsTest documentation regarding .expected file is misleading #5343

@Marcono1234

Description

@Marcono1234

For all languages the InlineExpectationsTest documentation is misleading regarding the .expected file:

Provides a library for writing QL tests whose success or failure is based on expected results embedded in the test source code as comments, rather than a .expected file.

To me that sounds like I can omit the .expected file, but that is not actually the case. When no .expected file is present CodeQL CLI will consider the test to fail because apparently expects some (arbitrary?) result:

0 tests passed; 1 tests failed:
FAILED: path/to/test.ql

failed: path/to/test.ql
Query produced no results.

Therefore it would be good to:

  • Improve the InlineExpectationsTest documentation by mentioning that an empty .expected file is needed
  • Improve CodeQL CLI to inform the user in the test output that no .expected file was found and therefore the expects the test query to yield some (arbitrary?) results

Or it should be verified, what result CodeQL CLI is actually expecting when no .expected file is present; the CodeQL CLI documentation is also not specific regarding this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StalequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions