-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle utf8 characters in the dune files(#9728)
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
- Loading branch information
1 parent
6848420
commit 509b6f5
Showing
4 changed files
with
155 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
module Utf8 : sig | ||
val next_utf8_length : string -> int -> int | ||
val is_utf8_valid : string -> int -> int -> bool | ||
end | ||
|
||
val escaped : string -> string | ||
val quoted : string -> string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 21 additions & 4 deletions
25
test/blackbox-tests/test-cases/formatting/non-ascii-characters.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
How the non-ASCII characters are handled, this is also related to the issue #9728 | ||
Utf8 characters are handled for now, this is also related to the issue #9728 | ||
|
||
$ dune format-dune-file <<EOF | ||
> ("É") | ||
> ("Éff ĎúÑȨ") | ||
> EOF | ||
("\195\137") | ||
("Éff ĎúÑȨ") | ||
|
||
$ dune format-dune-file <<EOF | ||
> (run foo %{bin:é}) | ||
> EOF | ||
File "", line 1, characters 15-16: | ||
Error: The character '\195' is not allowed inside %{...} forms | ||
Error: The character é is not allowed inside %{...} forms | ||
[1] | ||
|
||
$ dune format-dune-file <<EOF | ||
> (echo "hÉllo") | ||
> EOF | ||
(echo "hÉllo") | ||
|
||
$ dune format-dune-file <<EOF | ||
> (echo "É") | ||
> EOF | ||
(echo "É") | ||
|
||
$ dune format-dune-file <<EOF | ||
> (Écho "hello") | ||
> EOF | ||
File "", line 1, characters 1-1: | ||
Error: Invalid . file | ||
[1] |