Index: Source/Compiler.cobra
===================================================================
--- Source/Compiler.cobra	(revision 2419)
+++ Source/Compiler.cobra	(working copy)
@@ -335,7 +335,7 @@
 	def compileFilesNamed(paths as IList<of String>, writeTestInvocation as bool, stopCompilation as Predicate<of Compiler>?)
 		_initBackEnd
 		.defaultOutName = if(.options.buildStandardLibrary, 'Cobra.Lang.dll', paths[0])
-		if .options.boolValue('compile-if-needed')
+		if (.options.boolValue('compile') or .options.boolValue('run')) and .options.boolValue('compile-if-needed') 
 			outName = .backEnd.computeOutName	
 			if not .isCompilationNeeded(outName, paths)
 				return
Index: Tests/700-command-line/115-cin-test.cobra
===================================================================
--- Tests/700-command-line/115-cin-test.cobra	(revision 0)
+++ Tests/700-command-line/115-cin-test.cobra	(revision 0)
@@ -0,0 +1,10 @@
+# .skip. Run from 115-compile-if-needed-and-test.cobra
+# test case for -compile-if-needed and test tkt:236
+class P
+
+	def main is shared
+		test
+			expect AssertException
+				assert false
+		body
+			print 'hello'
Index: Tests/700-command-line/115-compile-if-needed-and-test.cobra
===================================================================
--- Tests/700-command-line/115-compile-if-needed-and-test.cobra	(revision 0)
+++ Tests/700-command-line/115-compile-if-needed-and-test.cobra	(revision 0)
@@ -0,0 +1,21 @@
+# test -compile-if-needed and test tkt:236
+class Test
+
+	def main is shared
+		file = '115-cin-test'
+		src  = '[file].cobra'
+		cobraPath = CobraCore.findCobraExe to !
+		p as System.Diagnostics.Process?
+		
+		.touch(src)
+		output = CobraCore.runCobraExe(cobraPath, '-cin -test [src]', out p)
+		assert '6 tests run' in output
+		assert '6 successes.' in output
+		assert '0 failures.' in output
+		assert p.exitCode == 0 
+		#print '.' stop
+		
+		
+	def touch(fileName as String) is shared
+		File.setLastWriteTime(fileName, DateTime.now)	
+		
Index: Developer/IntermediateReleaseNotes.text
===================================================================
--- Developer/IntermediateReleaseNotes.text	(revision 2419)
+++ Developer/IntermediateReleaseNotes.text	(working copy)
@@ -477,3 +477,6 @@
 * Fixed: File and line number are duplicated in some compiler error messages.  ticket:212
 
 * Fixed: Some invariants cause an internal error.  ticket:248
+
+* Fixed: -cin and -test gets ArgumentOutOfRangeException.  ticket:236
+

