Source

pygments-ecl / tests / examplefiles / example.xtend

package beer

import static extension beer.BottleSupport.*
import org.junit.Test

class BottleSong {

	@Test
	def void singIt() {
		println(singTheSong(99))
	}
	
	def singTheSong(int all) '''
		ŤFOR i : all .. 1ť
			Ťi.Bottlesť of beer on the wall, Ťi.bottlesť of beer.
			Take one down and pass it around, Ť(i - 1).bottlesť of beer on the wall.
			
		ŤENDFORť
		No more bottles of beer on the wall, no more bottles of beer.
		Go to the store and buy some more, Ťall.bottlesť of beer on the wall.
	'''

	def private java.lang.String bottles(int i) {
		switch i {
			case 0 : 'no more bottles'
			case 1 : 'one bottle'
			default : '''Ťiť bottles'''
		}.toString
	}	
	
	def String Bottles(int i) {
		bottles(i).toFirstUpper
	}
}