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

local labels in testcase label statement #5410

Open
adrianmgg opened this issue Mar 10, 2024 · 0 comments
Open

local labels in testcase label statement #5410

adrianmgg opened this issue Mar 10, 2024 · 0 comments

Comments

@adrianmgg
Copy link

the label statement in a testcase currently only works with global labels, since it doesn't accept a dotted foo.bar label.

afaict, the fix should be as simple as1 changing l.name to e.g. l.label_name here:

elif l.keyword("label"):
name = l.require(l.name)
return testast.Label(loc, name)

, but I'm opening an issue rather than a PR since I realize there's a bit of a design choice here -- parsing a label_name there would make it work with taking an implicit global label from above, and i'm not entirely sure if that behavior would be preferable or if it should only accept fully qualified labels

label foo:
    "hello world"
    "aaaaaaa"
label .bar:
    "abcdefg"

# this one already works
testcase with_global_label:
    click until label foo
    # = Until(left=..., right=Label(name="foo"))

# this one doesn't currently work but definitely seems like it should
testcase with_qualified_local_label:
    click until label foo.bar
    # = Until(left=..., right=Label(name="foo.bar"))

# should this one work?
testcase with_unqualified_local_label:
    click until label .bar
    # = Until(left=..., right=Label(name="foo.bar"))

Footnotes

  1. based on some quick print debugging it looks like renpy.test.testexecution.labels already contains strings for local labels (e.g. "foo.bar") too, and that's the only place renpy.test.testast.Label checks, so testast.Label(name="foo.bar") should just work

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

No branches or pull requests

1 participant