Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Externalized locale strings can't be split on multiple lines #623

@habuma

Description

@habuma

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:

  1. Create a locale-specific strings file in locales
  2. Add a string whose values span multiple lines and purposefully break a value in the 2nd line.
  3. Reference the string in a test
  4. 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions