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

🚚 Extend the snippet reverting logic to Slides #5340

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/slides/sl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ levels:
6:
header: Zaspi 5
text: "Za ukazom `{sleep}` lahko dodate številko, če želite, da je premor daljši.\n\nČe želite, lahko celo uporabite spremenljivko namesto številke, da določite koliko sekund naj program spi."
code: "premor {is} 10\n{print} Moja priljubljena barva je...\n{sleep} pause\n{print} zelena!"
code: "pause {is} 10\n{print} My favorite colour is...\n{sleep} pause\n{print} green!"
7:
header: Razhroščevanje
text: Razhroščevanje oziroma odpravljanje napak pomeni, da se znebite napak v programu. Skupaj razhroščimo to kodo. Kliknite na gumb pikapolonica, da zaženete razhroščevalnik.
Expand All @@ -130,7 +130,7 @@ levels:
4:
header: Naključno v stavku
text: Ukaz `{at}` `{random}` lahko uporabite tudi v stavku.
code: "žival {is} pes, mačka, kenguru\n{print Moja najljubša žival je {at} {random}"
code: "animals {is} dogs, cats, kangaroos\n{print} My favorite animal is animals {at} {random}"
5:
header: Add to
text: "Elemente lahko dodate na seznam z ukazom `{add}` `{to}`.\n\nIzberete lahko, kaj boste dodali na seznam, ali pa uporabite ukaz `{add}` `{to}` v kombinaciji z ukazom `{ask}`.\nTako lahko igralcem omgoočilte, da se odločijo, kaj dodati na seznam."
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snippets/snippet_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def collect_slides_snippets(path):
filename=file,
level=level_number if level_number > 0 else 1,
language=lang,
field_name=f'snippet {number}',
field_name=x,
code=y['code'])
Hedy_snippets.append(snippet)
number += 1
Expand Down
9 changes: 8 additions & 1 deletion tests/test_snippets/test_slides.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,11 @@
class TestsSlidesPrograms(snippet_tester.HedySnippetTester):
@parameterized.expand(Hedy_snippets, skip_on_empty=True)
def test_slide_programs(self, name, snippet):
self.do_snippet(snippet)
self.do_snippet(snippet, yaml_locator=slides_locator)


def slides_locator(snippet, yaml):
"""Returns where in the Slides YAML we found a Slides snippet."""
return snippet_tester.YamlLocation(
dict=yaml['levels'][snippet.level][snippet.field_name],
key='code')
Loading