summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lsp/JavaA/.ted-root0
-rw-r--r--test/lsp/JavaA/Main.java8
-rw-r--r--test/lsp/JavaB/.ted-root0
-rw-r--r--test/lsp/JavaB/B.java13
-rw-r--r--test/test.cpp62
-rw-r--r--test/test.go18
-rw-r--r--test/test.java13
-rw-r--r--test/test.js12
-rw-r--r--test/test.rs30
9 files changed, 156 insertions, 0 deletions
diff --git a/test/lsp/JavaA/.ted-root b/test/lsp/JavaA/.ted-root
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/lsp/JavaA/.ted-root
diff --git a/test/lsp/JavaA/Main.java b/test/lsp/JavaA/Main.java
new file mode 100644
index 0000000..2792b7c
--- /dev/null
+++ b/test/lsp/JavaA/Main.java
@@ -0,0 +1,8 @@
+public class Main {
+ public static void main(String[] args) {
+ int x = 0;
+ x++;
+ for (int i = 0; i < args.length; ++i) {
+ }
+ }
+}
diff --git a/test/lsp/JavaB/.ted-root b/test/lsp/JavaB/.ted-root
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/lsp/JavaB/.ted-root
diff --git a/test/lsp/JavaB/B.java b/test/lsp/JavaB/B.java
new file mode 100644
index 0000000..fde8107
--- /dev/null
+++ b/test/lsp/JavaB/B.java
@@ -0,0 +1,13 @@
+public class B {
+ private static class Something {
+ public int x = 0;
+ int f() {
+ return x;
+ }
+ }
+
+ public static void main(String[] args) {
+ Something s = new Something();
+ s.f();
+ }
+}
diff --git a/test/test.cpp b/test/test.cpp
new file mode 100644
index 0000000..e373bff
--- /dev/null
+++ b/test/test.cpp
@@ -0,0 +1,62 @@
+#include <iostream>
+char const *s = R"(
+Lorem ipsum dolor sit amet.
+It was the age of reason.
+It was the age of foolishness.
+do {
+ class x;
+} while (0.1238712e+12 != CHAR_MAX);
+)";
+using std::cout;
+
+template<typename T>
+class Option {
+public:
+ Option<T>() {
+ exists = false;
+ }
+ Option<T>(T const &t) {
+ set(t);
+ }
+ void set(T const &t) {
+ exists = true;
+ x = t;
+ }
+ void clear() {
+ exists = false;
+ }
+ T *get() {
+ if (exists)
+ return &x;
+ else
+ return nullptr;
+ }
+ T const *get() const {
+ if (exists)
+ return &x;
+ else
+ return nullptr;
+ }
+private:
+ bool exists;
+ T x;
+};
+
+template<typename T>
+void print_option(Option<T> const &o) {
+ T const *ptr = o.get();
+ if (ptr)
+ cout << *ptr << "\n";
+ else
+ cout << "None\n";
+}
+
+int main() {
+ Option<int> o(7);
+ print_option(o);
+ o.clear();
+ print_option(o);
+ o.set(133);
+ print_option(o);
+ return 0;
+}
diff --git a/test/test.go b/test/test.go
new file mode 100644
index 0000000..98eea24
--- /dev/null
+++ b/test/test.go
@@ -0,0 +1,18 @@
+package main
+
+import "fmt"
+
+/*
+what
+a
+wonderful
+day
+*///yes
+
+func main() {
+ var x []int = make([]int, 10)
+ fmt.Println(x != nil)
+ println(`hello
+ world\`)
+ println("yes\"\\")
+}
diff --git a/test/test.java b/test/test.java
new file mode 100644
index 0000000..7183aed
--- /dev/null
+++ b/test/test.java
@@ -0,0 +1,13 @@
+class Test {
+ public static void main(String[] args) {
+ /* hello!
+ everyone
+ this
+ is
+ a test*/
+ String x = "hello, world!\"";
+ System.out.println(x +
+ "yes\n\\"+
+ x);
+ }
+}
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..ad95614
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,12 @@
+const c = `template
+strings
+yay
+`;
+let y = 34 * parseInt('hello\\\'\\"') + "'\\";
+/*
+comm
+ent
+
+*/a//yes
+/*
+*//no
diff --git a/test/test.rs b/test/test.rs
new file mode 100644
index 0000000..40c2438
--- /dev/null
+++ b/test/test.rs
@@ -0,0 +1,30 @@
+/*
+testing comments
+/* /* /* /* /* hello */ */ */ */ */
+yay
+*/
+use std::fs::File;
+use std::io::{Result, BufRead, BufReader};
+fn main() -> Result<()> {
+ let file = File::open("test.rs")?;
+ let mut reader = BufReader::new(file);
+ let mut lines = vec![];
+
+ loop {
+ let mut line = String::new();
+ if reader.read_line(&mut line)? == 0 {
+ // reached end of file
+ break;
+ }
+ line.pop();
+ lines.push(line);
+ }
+let x = lines.
+ for line in lines {
+ println!("{}", line);
+ }
+ print!("
+ string
+ ");
+ Ok(())
+}