Sha256: 48ef1f4c1e57b9f34cec0f30c8a637004e39b2c4692c26748c70b662c60cfe01

Contents?: true

Size: 727 Bytes

Versions: 23

Compression:

Stored size: 727 Bytes

Contents

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
	}
}

Version data entries

23 entries across 23 versions & 5 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/pygments.rb-0.6.3/vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.6.3 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.6.2 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.6.1 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.6.0 vendor/pygments-main/tests/examplefiles/example.xtend
mortar-pygments.rb-0.5.7 vendor/pygments-main/tests/examplefiles/example.xtend
mortar-pygments.rb-0.5.6 vendor/pygments-main/tests/examplefiles/example.xtend
mortar-pygments.rb-0.5.5 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-jruby-0.5.4.2 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-jruby-0.5.4.1 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-jruby-0.5.4 vendor/pygments-main/tests/examplefiles/example.xtend
gitlab-pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.5.4 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.5.2 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.5.1 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.5.0 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.4.2 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.4.1 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.3.7 vendor/pygments-main/tests/examplefiles/example.xtend
pygments.rb-0.3.6 vendor/pygments-main/tests/examplefiles/example.xtend