markdown2 :: TestFile :: defaultinit
markdown2 :: TestFile :: test_classes
Test classes in this modulemarkdown2 :: TestFile :: test_classes=
Test classes in this modulemarkdown2 :: TestFile :: test_file_name=
Test module namecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
markdown2 :: TestFile :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).markdown2 :: TestFile :: test_classes
Test classes in this modulemarkdown2 :: TestFile :: test_classes=
Test classes in this modulemarkdown2 :: TestFile :: test_file_name=
Test module name
# 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