Nitlanguage.org
  • Nitdoc
  • markdown2
  • tests
  • commonmark_gen
  • TestFile
  • defaultinit

init defaultinit(test_file_name: String)

markdown2 :: TestFile :: defaultinit

  • Doc
  • Linearization

Summary

  • Property definitions

  • markdown2$TestFile$defaultinit

Property definitions

markdown2 $ TestFile :: defaultinit
# A Nitunit test file
class TestFile

	# Test module name
	var test_file_name: String

	# Test classes in this module
	var test_classes = new Array[TestClass]

	# Copyright header and module declaration
	fun header: String do
		return """
# This file is part of NIT ( http://www.nitlanguage.org ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module {{{test_file_name}}} is test

import test_markdown
"""
	end

	# Render the test module as a Nit string
	fun render: String do
		var tpl = new Template
		tpl.add header
		for test_class in test_classes do
			tpl.add test_class.render
		end
		return tpl.write_to_string
	end

	# Save the test module in `directory
	fun save(directory: String) do
		render.write_to_file(directory / "{test_file_name}.nit")
	end
end
lib/markdown2/tests/commonmark_gen.nit:150,1--196,3
Nit standard library. Version .