Skip to content

Commit

Permalink
chore: update moc to 0.10.1 (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif authored Oct 16, 2023
2 parents 475e617 + 5f70a62 commit 80ededb
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# Remember to update me in package-set.yml as well
env:
vessel_version: "v0.7.0"
moc_version: "0.10.0"
moc_version: "0.10.1"

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-set.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
vessel_version: "v0.7.0"
moc_version: "0.10.0"
moc_version: "0.10.1"

jobs:
verify:
Expand Down
18 changes: 17 additions & 1 deletion src/Text.mo
Original file line number Diff line number Diff line change
Expand Up @@ -806,5 +806,21 @@ module {
/// ```motoko include=import
/// let text = Text.decodeUtf8("\48\65\6C\6C\6F"); // ?"Hello"
/// ```
public let decodeUtf8 : Blob -> ?Text = Prim.decodeUtf8
public let decodeUtf8 : Blob -> ?Text = Prim.decodeUtf8;

/// Returns the text argument in lowercase.
/// WARNING: Unicode compliant only when compiled, not interpreted.
///
/// ```motoko include=import
/// let text = Text.toLowercase("Good Day"); // ?"good day"
/// ```
public let toLowercase : Text -> Text = Prim.textLowercase;

/// Returns the text argument in uppercase. Unicode compliant.
/// WARNING: Unicode compliant only when compiled, not interpreted.
///
/// ```motoko include=import
/// let text = Text.toUppercase("Good Day"); // ?"GOOD DAY"
/// ```
public let toUppercase : Text -> Text = Prim.textUppercase;
}
64 changes: 64 additions & 0 deletions test/Text.test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -1048,4 +1048,68 @@ run(
)
]
)
);

run(
suite(
"text-toLowercase",
[
test(
"empty",
Text.toLowercase(""),
M.equals(T.text "")
),
test(
"printable ascii",
Text.toLowercase(
"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
),
M.equals(T.text
"!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
),
),
test(
"ὈDYSSEUS",
Text.toLowercase("ὈΔΥΣΣΕΎΣ"),
M.equals(T.text "ὀδυσσεύς")
),
test(
"new year",
Text.toLowercase("农历新年"),
M.equals(T.text "农历新年")
)
]
)
);

run(
suite(
"text-toUppercase",
[
test(
"empty",
Text.toUppercase(""),
M.equals(T.text "")
),
test(
"printable ascii",
Text.toUppercase(
"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
),
M.equals(T.text
"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~"
),
),
test(
"odysseus",
Text.toUppercase("ὀδυσσεύς"),
M.equals(T.text "ὈΔΥΣΣΕΎΣ")
),
test(
"new year",
Text.toUppercase("农历新年"),
M.equals(T.text "农历新年")
)
]
)
)

0 comments on commit 80ededb

Please sign in to comment.