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

Add tests for builtin strings::lower method #313

Merged
Merged
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
79 changes: 79 additions & 0 deletions tests/interpreter/cases/builtins/strings/lower.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

cases:
- note: base
data: {}
modules:
- |
package test

v1 = lower("") # empty string
v2 = lower("a")
v3 = lower("A")
v4 = lower("AbCd")
v5 = lower("aBcD109")
v6 = lower("aabAB09_")
v7 = lower("longStrinGwitHmixofsmaLLandcAps")

query: data.test
want_result:
v1: ""
v2: "a"
v3: "a"
v4: "abcd"
v5: "abcd109"
v6: "aabab09_"
v7: "longstringwithmixofsmallandcaps"

- note: unicode string
data: {}
modules:
- |
package test

v1 = lower("Σ")
v2 = lower("ὈΔΥΣΣΕΎΣ")
v3 = lower("LONG\u2C6FSTRING\u2C6FWITH\u2C6FNONASCII\u2C6FCHARS")

query: data.test
want_result:
v1: "σ"
v2: "ὀδυσσεύς"
v3: "long\u0250string\u0250with\u0250nonascii\u0250chars"

- note: invalid-null-string
data: {}
modules: ["package test\nx=lower(null)"]
query: data.test
error: "`lower` expects string argument."

- note: invalid-bool-string
data: {}
modules: ["package test\nx=lower(true)"]
query: data.test
error: "`lower` expects string argument."

- note: invalid-number-string
data: {}
modules: ["package test\nx=lower(1)"]
query: data.test
error: "`lower` expects string argument."

- note: invalid-array-string
data: {}
modules: ["package test\nx=lower([])"]
query: data.test
error: "`lower` expects string argument."

- note: invalid-set-string
data: {}
modules: ["package test\nx=lower(set())"]
query: data.test
error: "`lower` expects string argument."

- note: invalid-object-string
data: {}
modules: ["package test\nx=lower({})"]
query: data.test
error: "`lower` expects string argument."
Loading