-
Notifications
You must be signed in to change notification settings - Fork 20
Externalized locale strings can't be split on multiple lines #623
Description
Description:
When specifying a lengthy expected value for response.outputSpeech.ssml
in the test itself, I can easily break the line apart with a line break in the YAML itself. E.g.:
---
- test: Launch request
- LaunchRequest:
- response.outputSpeech.ssml: Welcome back, Craig!
How can I help you?
But if I try to extract that string to locales/en.yml
, I can't break the value across multiple lines. E.g., this doesn't work:
welcomeMessagePersonal: Welcome back , Craig!
How can I help you?
Actually, it does pass, but only because it checks that the actual result starts with what is on the first line. If the content of the 2nd line doesn't match, it still passes.
Environment:
- Version: 2.4.24
- OS: MacOS 10.15
- Node version: 12.13.0
Steps To Reproduce
Steps to reproduce the behavior:
- Create a locale-specific strings file in
locales
- Add a string whose values span multiple lines and purposefully break a value in the 2nd line.
- Reference the string in a test
- Run
bst test
and observe that the test may pass, because it's not considering the 2nd line.
Expected behavior
If the string value spans multiple lines, it should use the entire string value when comparing with the actual value. (Again, this works if I specify the string in the test itself, but not if it's specified in the locale-specific string file under locales/
.)
Actual behavior
Even if any part of the expected string in a line after the first line doesn't match, the test will still pass because it's only using the first line and asserting that the actual string starts with that first line.
Code example
Here's a slightly more complete example, tested against a skill whose launch request handler returns "Welcome, you can say Hello or Help. Which would you like to try?" in response.outputSpeech.ssml
.
In test/unit/index.test.yml
:
---
configuration:
description: My first unit test suite
locales: en-US
# Both of these SHOULD fail...
# This fails, as expected, because the 2nd line doesn't
# match the response
---
- test: Launch request (This fails)
- LaunchRequest:
- response.outputSpeech.ssml: Welcome, you can say Hello or Help.
What do you want to do?
# This passes, even though the 2nd line in locales/en.yml
# doesn't match the response
---
- test: Launch request (This doesn't fail)
- LaunchRequest:
- response.outputSpeech.ssml: welcomeMessage
And in test/unit/locales/en.yml
:
welcomeMessage: Welcome, you can say Hello or Help.
What do you want to do?
Note, that per the comments in index.test.yml
, both tests should fail, but only one does. The one referencing the localized string does not fail.