Skip to content

Commit

Permalink
feat(objectionary#801): add unit tests that shows that convertation o…
Browse files Browse the repository at this point in the history
…f unicode characters to directives works well
  • Loading branch information
volodya-lombrozo committed Oct 26, 2024
1 parent 61e9da2 commit e8ef4fe
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@
package org.eolang.jeo.representation.directives;

import com.jcabi.matchers.XhtmlMatchers;
import org.eolang.jeo.representation.bytecode.BytecodeField;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.objectweb.asm.Opcodes;
import org.xembly.ImpossibleModificationException;
import org.xembly.Xembler;
Expand Down Expand Up @@ -81,4 +84,31 @@ void convertsLongFieldToDirectives() throws ImpossibleModificationException {
)
);
}

@ParameterizedTest
@ValueSource(strings = {
"Φ", "Ψ", "Ω", "Δ", "Σ", "Θ", "Λ", "Ξ", "Π", "Υ", "\u03A3", "\u03A6", "\u03A8", "\u03A9"
})
void convertsDirectivesFieldWithUnicodeName(
final String original
) throws ImpossibleModificationException {
MatcherAssert.assertThat(
"We expect the field name with unicode characters to be successfully converted to directives",
new Xembler(
new BytecodeField(
original,
"I",
"",
0,
Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL
).directives()
).xml(),
XhtmlMatchers.hasXPaths(
String.format(
"/o[contains(@base,'field') and contains(@name,'%s')]",
original
)
)
);
}
}

0 comments on commit e8ef4fe

Please sign in to comment.