Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
elringus committed Nov 13, 2023
1 parent 4e2be92 commit e745a6c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/.vitepress/ext/language/naniscript.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
{
"comment": "Text Identifier - |#Textid|",
"name": "naniscript.textidentifier",
"match": "(?<!\\\\)\\|#\\w+\\|"
"match": "(?<!\\\\)\\|#[\\w-]+\\|"
},
{
"comment": "Text Identifier - |#|",
Expand Down
15 changes: 15 additions & 0 deletions docs/guide/automated-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ ISequence RouteY => On(Choosing, Choose(), Var("g_completedY", false));

— notice how choice sequences for days 1-3 of the common route leading either to "X" or "Y" routes are composed to `CommonX` and `CommonY` variables, which are in turn composed inside the actual test method.

## Referencing Choices

As you've noticed above, choices can be referenced in the tests via strings like `d1-qte-x`. Those are custom [text identifiers](/guide/naninovel-scripts#text-identification) assigned in scenario scripts. Even when stable text identification is enabled, you can still define custom text IDs in the scripts and they will be preserved by the system. For example, consider following scenario script:

```nani
@choice "Choice 1|#my-id-for-choice-1|"
@choice "Choice 2|#my-id-for-choice-2|"
```

— here we've assigned `my-id-for-choice-1` for the first choice and `my-id-for-choice-2` for the second one; actual IDs can be anything, just make sure they're unique inside the script. You can now reference the choices in the tests via the assigned IDs:

```csharp
Once(Choosing).Choose("my-id-for-choice-2")
```

::: tip EXAMPLE
Find sample E2E project on GitHub: [github.com/Naninovel/E2E](https://github.com/Naninovel/E2E). It shows most of the available shortcuts, extensions and testing scenarios.
:::
Expand Down

0 comments on commit e745a6c

Please sign in to comment.