Skip to content

Commit

Permalink
added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jlangch committed Mar 27, 2024
1 parent 32dcc8c commit 1a23eb5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2939,6 +2939,8 @@ public VncVal apply(final VncList args) {
"(h/dump (bytebuf-from-string (str/normalize-utf \"\\u00FC\" :NFD))) \n" +
";; 00000000: 75cc 88 u.. \n" +
"``` ")
.seeAlso(
"io/file-normalize-utf")
.build()
) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static com.github.jlangch.venice.impl.util.StringUtil.to_lf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -291,6 +292,36 @@ public void test_io_file_ext() {
}
}

@Test
public void test_io_file_normalize_utf_1() {
final Venice venice = new Venice();

final String script = "(io/file-path (io/file \"/test_\\u00FC.txt\")))";

assertEquals("/test_ü.txt", venice.eval(script));
}

@Test
public void test_io_file_normalize_utf_2() {
final Venice venice = new Venice();

final String script1 = "(io/file-path (io/file \"/test_u\\u0308.txt\")))";
assertNotEquals("/test_ü.txt", venice.eval(script1));

final String script2 = "(io/file-path (io/file \"/test_u\\u0308.txt\")))";
assertEquals("/test_u\u0308.txt", venice.eval(script2));
}

@Test
public void test_io_file_normalize_utf_3() {
final Venice venice = new Venice();

final String script = "(== \"/test_\\u00FC.txt\"" +
" (io/file-path (io/file-normalize-utf \"/test_u\\u0308.txt\")))";

assertTrue((Boolean)venice.eval(script));
}

@Test
public void test_io_file_within_dir_Q() {
final Venice venice = new Venice();
Expand Down

0 comments on commit 1a23eb5

Please sign in to comment.