mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 02:49:06 +00:00
fix: allow (int
corresponding of) unicode value for Chr
builtin fct
That fixes partialy #1571.
This commit is contained in:
parent
1cb61d5609
commit
3f836a44cc
@ -59,8 +59,8 @@ public class Chr extends SimpleReturnFunction {
|
||||
public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List<TValue> values,
|
||||
Map<String, TValue> named) throws EaterException, EaterExceptionLocated {
|
||||
try {
|
||||
final char value = (char) values.get(0).toInt();
|
||||
return TValue.fromString("" + value);
|
||||
final String value = String.valueOf(Character.toChars(values.get(0).toInt()));
|
||||
return TValue.fromString(value);
|
||||
} catch (Throwable t) {
|
||||
return TValue.fromString("\0");
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ class ChrTest {
|
||||
" 34 , '\"' ",
|
||||
" 224 , à ",
|
||||
" 233 , é ",
|
||||
// TODO: fix `%chr` to allow Unicode chars, the corresponding tests are here:
|
||||
// " 128512 , 😀 ",
|
||||
// " 128512 , \uD83D\uDE00 ",
|
||||
// DONE: fix `%chr` to allow Unicode chars, the corresponding tests are here:
|
||||
" 128512 , 😀 ",
|
||||
" 128512 , \uD83D\uDE00 ",
|
||||
})
|
||||
void executeReturnFunctionChrTest(Integer input, String expected) throws EaterException, EaterExceptionLocated {
|
||||
Chr cut = new Chr();
|
||||
|
Loading…
Reference in New Issue
Block a user