Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
92d6896c
Unverified
Commit
92d6896c
authored
Oct 30, 2026
by
vercel-fleet-prod[bot]
Committed by
GitHub
Oct 30, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop utf16_len helper tests
Co-authored-by:
Luke Sandberg
<
210140+lukesandberg@users.noreply.github.com
>
parent
23345b85
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
41 deletions
+1
-41
source_pos.rs
turbopack/crates/turbopack-core/src/source_pos.rs
+1
-41
No files found.
turbopack/crates/turbopack-core/src/source_pos.rs
View file @
92d6896c
...
@@ -123,7 +123,7 @@ impl std::cmp::PartialEq<(u32, u32)> for SourcePos {
...
@@ -123,7 +123,7 @@ impl std::cmp::PartialEq<(u32, u32)> for SourcePos {
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
super
::
{
SourcePos
,
utf16_len
}
;
use
super
::
SourcePos
;
fn
pos_after
(
code
:
&
str
)
->
SourcePos
{
fn
pos_after
(
code
:
&
str
)
->
SourcePos
{
let
mut
pos
=
SourcePos
::
new
(
0
);
let
mut
pos
=
SourcePos
::
new
(
0
);
...
@@ -131,46 +131,6 @@ mod tests {
...
@@ -131,46 +131,6 @@ mod tests {
pos
pos
}
}
#[test]
fn
utf16_len_matches_std
()
{
for
s
in
[
""
,
"abc"
,
"é€"
,
"🦀"
,
"x🦀é€😀y
\n\r
\
u{2028}"
,
"
\
u{0}
\
u{7f}
\
u{80}
\
u{7ff}
\
u{800}
\
u{ffff}
\
u{10000}
\
u{10ffff}"
,
]
{
assert_eq!
(
utf16_len
(
s
.as_bytes
()),
s
.encode_utf16
()
.count
(),
"{s:?}"
);
}
}
#[test]
fn
utf16_len_counts_invalid_utf8_per_byte
()
{
fn
per_byte
(
bytes
:
&
[
u8
])
->
usize
{
bytes
.iter
()
.map
(|
&
b
|
1
+
(
b
>=
0xF0
)
as
usize
-
((
b
&
0xC0
)
==
0x80
)
as
usize
)
.sum
()
}
// Lone continuation bytes, truncated sequences and bytes that never appear in UTF-8,
// both short and long enough to go through the vectorized loops.
let
long
=
[
b
"x
\x80\xC3\xE2\x80\xF0\x9F\xA6\xFF\xFE
"
.as_slice
();
32
]
.concat
();
for
bytes
in
[
b
"
\x80
"
.as_slice
(),
b
"
\xC3
"
,
b
"
\xE2\x80
"
,
b
"
\xF0\x9F\xA6
"
,
b
"
\xFF\xFE
"
,
b
"abc
\xF0
"
,
&
long
,
&
long
[
1
..
],
]
{
assert_eq!
(
utf16_len
(
bytes
),
per_byte
(
bytes
),
"{bytes:?}"
);
}
}
#[test]
#[test]
fn
counts_ascii_as_one_column
()
{
fn
counts_ascii_as_one_column
()
{
assert_eq!
(
pos_after
(
"abc"
),
(
0
,
3
));
assert_eq!
(
pos_after
(
"abc"
),
(
0
,
3
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment