mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Merge pull request #7321 from shua/fromutf8
DO NOT MERGE update Str.fromUtf8 error type
This commit is contained in:
commit
8540aa1a14
10 changed files with 105 additions and 105 deletions
|
@ -692,7 +692,7 @@ fn str_from_utf8_fail_invalid_start_byte() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 0x80, 99] is
|
||||
Err (BadUtf8 InvalidStartByte byteIndex) ->
|
||||
Err (BadUtf8 {problem: InvalidStartByte, index: byteIndex}) ->
|
||||
if byteIndex == 2 then
|
||||
"a"
|
||||
else
|
||||
|
@ -712,7 +712,7 @@ fn str_from_utf8_fail_unexpected_end_of_sequence() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 99, 0xC2] is
|
||||
Err (BadUtf8 UnexpectedEndOfSequence byteIndex) ->
|
||||
Err (BadUtf8 {problem: UnexpectedEndOfSequence, index: byteIndex}) ->
|
||||
if byteIndex == 3 then
|
||||
"a"
|
||||
else
|
||||
|
@ -732,7 +732,7 @@ fn str_from_utf8_fail_expected_continuation() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 99, 0xC2, 0x00] is
|
||||
Err (BadUtf8 ExpectedContinuation byteIndex) ->
|
||||
Err (BadUtf8 {problem: ExpectedContinuation, index: byteIndex}) ->
|
||||
if byteIndex == 3 then
|
||||
"a"
|
||||
else
|
||||
|
@ -752,7 +752,7 @@ fn str_from_utf8_fail_overlong_encoding() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 0xF0, 0x80, 0x80, 0x80] is
|
||||
Err (BadUtf8 OverlongEncoding byteIndex) ->
|
||||
Err (BadUtf8 {problem: OverlongEncoding, index: byteIndex}) ->
|
||||
if byteIndex == 1 then
|
||||
"a"
|
||||
else
|
||||
|
@ -772,7 +772,7 @@ fn str_from_utf8_fail_codepoint_too_large() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 0xF4, 0x90, 0x80, 0x80] is
|
||||
Err (BadUtf8 CodepointTooLarge byteIndex) ->
|
||||
Err (BadUtf8 {problem: CodepointTooLarge, index: byteIndex}) ->
|
||||
if byteIndex == 1 then
|
||||
"a"
|
||||
else
|
||||
|
@ -792,7 +792,7 @@ fn str_from_utf8_fail_surrogate_half() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 0xED, 0xA0, 0x80] is
|
||||
Err (BadUtf8 EncodesSurrogateHalf byteIndex) ->
|
||||
Err (BadUtf8 {problem: EncodesSurrogateHalf, index: byteIndex}) ->
|
||||
if byteIndex == 2 then
|
||||
"a"
|
||||
else
|
||||
|
|
|
@ -522,7 +522,7 @@ fn str_from_utf8_fail_invalid_start_byte() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 0x80, 99] is
|
||||
Err (BadUtf8 InvalidStartByte byteIndex) ->
|
||||
Err (BadUtf8 {problem: InvalidStartByte, index: byteIndex}) ->
|
||||
if byteIndex == 2 then
|
||||
"a"
|
||||
else
|
||||
|
@ -541,7 +541,7 @@ fn str_from_utf8_fail_unexpected_end_of_sequence() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 99, 0xC2] is
|
||||
Err (BadUtf8 UnexpectedEndOfSequence byteIndex) ->
|
||||
Err (BadUtf8 {problem: UnexpectedEndOfSequence, index: byteIndex}) ->
|
||||
if byteIndex == 3 then
|
||||
"a"
|
||||
else
|
||||
|
@ -560,7 +560,7 @@ fn str_from_utf8_fail_expected_continuation() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 99, 0xC2, 0x00] is
|
||||
Err (BadUtf8 ExpectedContinuation byteIndex) ->
|
||||
Err (BadUtf8 {problem: ExpectedContinuation, index: byteIndex}) ->
|
||||
if byteIndex == 3 then
|
||||
"a"
|
||||
else
|
||||
|
@ -579,7 +579,7 @@ fn str_from_utf8_fail_overlong_encoding() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 0xF0, 0x80, 0x80, 0x80] is
|
||||
Err (BadUtf8 OverlongEncoding byteIndex) ->
|
||||
Err (BadUtf8 {problem: OverlongEncoding, index: byteIndex}) ->
|
||||
if byteIndex == 1 then
|
||||
"a"
|
||||
else
|
||||
|
@ -598,7 +598,7 @@ fn str_from_utf8_fail_codepoint_too_large() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 0xF4, 0x90, 0x80, 0x80] is
|
||||
Err (BadUtf8 CodepointTooLarge byteIndex) ->
|
||||
Err (BadUtf8 {problem: CodepointTooLarge, index: byteIndex}) ->
|
||||
if byteIndex == 1 then
|
||||
"a"
|
||||
else
|
||||
|
@ -617,7 +617,7 @@ fn str_from_utf8_fail_surrogate_half() {
|
|||
indoc!(
|
||||
r#"
|
||||
when Str.fromUtf8 [97, 98, 0xED, 0xA0, 0x80] is
|
||||
Err (BadUtf8 EncodesSurrogateHalf byteIndex) ->
|
||||
Err (BadUtf8 {problem: EncodesSurrogateHalf, index: byteIndex}) ->
|
||||
if byteIndex == 2 then
|
||||
"a"
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue