diff options
author | Sylvain Chiron <chironsylvain@orange.fr> | 2023-02-26 18:20:01 +0100 |
---|---|---|
committer | Sylvain Chiron <chironsylvain@orange.fr> | 2023-02-26 18:20:01 +0100 |
commit | 96538fe2de77dd534e8ff66b0dac749b801173c3 (patch) | |
tree | bbb8e515e138c7c71c82883afa24151966aecc9c | |
parent | d4d0b9a3cf67c596f3be164db1ab26d0aafbfdd2 (diff) | |
download | gtksourceview-96538fe2de77dd534e8ff66b0dac749b801173c3.tar.gz |
New file: tests/syntax-highlighting/file.java
-rw-r--r-- | tests/syntax-highlighting/file.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/syntax-highlighting/file.java b/tests/syntax-highlighting/file.java new file mode 100644 index 00000000..263aa733 --- /dev/null +++ b/tests/syntax-highlighting/file.java @@ -0,0 +1,57 @@ +// This file should compile and execute + +import static java.lang.System.out; + +interface I { + void foo(); + String[] bar(boolean okay); +} + +abstract class C implements I { + public static void println(String str) { + out.println(str); + } + + @Override + public void foo() {} +} + +enum E { YEAH } + +/** Do you document your API? + * @param fake Oh no! + * @return What? + */ +record R<T>(int i, double d, char c, Object o, T special) { + private static final byte thing = 0; +} + +public final class /* the same as the file name */ file extends C { + @Override + public String[] bar(boolean okay) { + return new String[] { + "Float: " + 1f + " or " + 1.e+0f, + "Double: " + 1d + " or " + 1.0e-0d, + "Long: " + 1L + " or " + 0x1l, + "Unsigned: don’t exist in Java", + "Escaped chars: \\ \" \101 " + '\141', + }; + } + + public static void main(String[] args) { + println(E.YEAH.toString()); + var me = new file(); + me.foo(); + for (var wysiwyg: me.bar(false)) { + println(wysiwyg); + } + while (me != null) { + me = null; + } + var what = switch ("hey") { + case "" -> ""; + default -> { yield "Have fun\u0021"; } + }; + println(what.toUpperCase()); + } +} |