53 lines
2.0 KiB
Plaintext
53 lines
2.0 KiB
Plaintext
package org.example
|
|
|
|
fun main(args: Array<String>) <beginfold id='1'>{</beginfold id='1'>
|
|
val sum1 = add(5, 6)
|
|
println(sum1)
|
|
println(<beginfold id='2'>"""</beginfold id='2'>
|
|
$$a${1+2}\$$
|
|
abc
|
|
<endfold id='2'>"""</endfold id='2'>)
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
<beginfold id='3'>/*</beginfold id='3'>*
|
|
* add function with two, three or four integer arguments
|
|
* c : default argument is 0
|
|
* d : default argument is 0
|
|
<endfold id='3'>*/</endfold id='3'>
|
|
fun add(a:Int, b:Int, c:Int = 0, d:Float = 12e10F): Int <beginfold id='1'>{</beginfold id='1'>
|
|
return a + b + c + d
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
public class MyTest <beginfold id='1'>{</beginfold id='1'>
|
|
lateinit var subject: TestSubject
|
|
|
|
val dyn: dynamic
|
|
|
|
@get:Rule val tempFolder = TemporaryFolder()
|
|
|
|
@set:[Inject VisibleForTesting]
|
|
var collaborator: Collaborator
|
|
|
|
@SetUp fun setup() <beginfold id='1'>{</beginfold id='1'>
|
|
subject = TestSubject()
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
fun @receiver:Fancy String.myExtension() <beginfold id='1'>{</beginfold id='1'>
|
|
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
@Test fun test() <beginfold id='1'>{</beginfold id='1'>
|
|
subject.method() // dereference directly
|
|
<endfold id='1'>}</endfold id='1'>
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
import <beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'> foo.Foo // comment
|
|
class <beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'> Foo <beginfold id='1'>{</beginfold id='1'>
|
|
fun <beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'> foo(<beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'>) <beginfold id='1'>{</beginfold id='1'>
|
|
|
|
<endfold id='1'>}</endfold id='1'>
|
|
|
|
val <beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'> bar = 1
|
|
var <beginfold id='3'>/*</beginfold id='3'> comment <endfold id='3'>*/</endfold id='3'> baz = 2
|
|
<endfold id='1'>}</endfold id='1'>
|