Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more information to default where: block check names #1773

Open
wants to merge 1 commit into
base: horizon
Choose a base branch
from

Conversation

jpolitz
Copy link
Member

@jpolitz jpolitz commented Feb 17, 2025

All check blocks come with a default name.

For where blocks, it is simply a copy of the function name.

With new CLI options like --checks "only:<pat>" that do substring matching, it's useful to have more information in these names. For example, a common case in an autograder might involve matching the name of a test case to express ``the name of the where block for the function called f''.

This changes the where block naming from:

file:///Users/joe/src/pyret-lang/test.arr:3:0-7:3: f (0/1)

  line 6, column 2: failed because:
    Values not equal 6 8

Passed: 0; Failed: 1; Ended in Error: 0; Total: 1

to:

file:///Users/joe/src/pyret-lang/test.arr:3:0-7:3: f() where block (0/1)

  line 6, column 2: failed because:
    Values not equal 6 8

Passed: 0; Failed: 1; Ended in Error: 0; Total: 1

All check blocks come with a default name.

For where blocks, it is simply a copy of the function name.

With new CLI options like --checks "only:<pat>" that do substring matching,
it's useful to have more information in these names. For example, a common case
in an autograder might involve matching the name of a test case to express
``the name of the where block for the function called f''.

This changes the where block naming from:

file:///Users/joe/src/pyret-lang/test.arr:3:0-7:3: f (0/1)

  line 6, column 2: failed because:
    Values not equal 6 8

Passed: 0; Failed: 1; Ended in Error: 0; Total: 1

to:

file:///Users/joe/src/pyret-lang/test.arr:3:0-7:3: f() where block (0/1)

  line 6, column 2: failed because:
    Values not equal 6 8

Passed: 0; Failed: 1; Ended in Error: 0; Total: 1
@jpolitz
Copy link
Member Author

jpolitz commented Feb 17, 2025

@shriram @dbp @blerner bikeshed away

@jpolitz
Copy link
Member Author

jpolitz commented Feb 17, 2025

Just to be clear the above is the CLI output for

fun f(x):
  x + 1
where:
  f(5) is 8
end

@dbp
Copy link
Collaborator

dbp commented Feb 17, 2025

Is there already a convention in errors and messages whether the : is included when referencing types of blocks? My inclination would be to say f() where: block (as you did in the PR title 😉) but if the convention is to not include : then ignore me.

@blerner
Copy link
Member

blerner commented Feb 17, 2025

Obvious argument: () is misleading as it's not the signature of the function

Obvious counterargument: should the test name include the names of the function arguments? In examplar situations, that parameter names might not be stable/consistent.

At minimum, I'd write (...) instead, but I wonder what a useful middle-ground might be for making the function header more accurate in these test names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants