diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examplefiles/antlr_throws | 1 | ||||
-rw-r--r-- | tests/examplefiles/example.kt | 47 | ||||
-rw-r--r-- | tests/examplefiles/example.sh-session | 2 | ||||
-rw-r--r-- | tests/examplefiles/example.tea | 34 | ||||
-rw-r--r-- | tests/examplefiles/function.mu | 1 |
5 files changed, 85 insertions, 0 deletions
diff --git a/tests/examplefiles/antlr_throws b/tests/examplefiles/antlr_throws new file mode 100644 index 00000000..816d8914 --- /dev/null +++ b/tests/examplefiles/antlr_throws @@ -0,0 +1 @@ +public f throws a, b, c : x ; diff --git a/tests/examplefiles/example.kt b/tests/examplefiles/example.kt new file mode 100644 index 00000000..59291333 --- /dev/null +++ b/tests/examplefiles/example.kt @@ -0,0 +1,47 @@ +package addressbook + +class Contact( + val name : String, + val emails : List<EmailAddress>, + val addresses : List<PostalAddress>, + val phonenums : List<PhoneNumber> +) + +class EmailAddress( + val user : String, + val host : String +) + +class PostalAddress( + val streetAddress : String, + val city : String, + val zip : String, + val state : USState?, + val country : Country +) { + assert {(state == null) xor (country == Countries["US"]) } +} + +class PhoneNumber( + val country : Country, + val areaCode : Int, + val number : Long +) + +object Countries { + fun get(id : CountryID) : Country = countryTable[id] + + private var table : Map<String, Country>? = null + private val countryTable : Map<String, Country> + get() { + if (table == null) { + table = HashMap() + for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) { + table[line] = Country(line) + } + } + return table + } +} + +class Country(val name : String)
\ No newline at end of file diff --git a/tests/examplefiles/example.sh-session b/tests/examplefiles/example.sh-session index 35b81ebb..02f3bb0d 100644 --- a/tests/examplefiles/example.sh-session +++ b/tests/examplefiles/example.sh-session @@ -15,3 +15,5 @@ user@host:~/path$ su root@host:~# sh-3.1$ # on hardy sh$ # on etch +(virtualenv-name)user@host:~$ ls -a + diff --git a/tests/examplefiles/example.tea b/tests/examplefiles/example.tea new file mode 100644 index 00000000..6859e34d --- /dev/null +++ b/tests/examplefiles/example.tea @@ -0,0 +1,34 @@ +<% template example() {...} +a = 123 +b = "test"; +c = 4.5 +d = call other() +f = other2() + +define g as String + +h = true +i = false +j = null +%> +<html> +<head> +<title>Example<title> +<body> +<a href="http://example.com">Test link</a> +<% // Second block +if(a == 123 and b == "test") { + 'yes' +} else { + 'no' +} + +foreach(i in 1..10) { + i & "," +} + +foreach(i in #(1,2,3) reverse { + i & ";" +} + +%>
\ No newline at end of file diff --git a/tests/examplefiles/function.mu b/tests/examplefiles/function.mu new file mode 100644 index 00000000..46bb259d --- /dev/null +++ b/tests/examplefiles/function.mu @@ -0,0 +1 @@ +a::b () |