Skip to content

Kotlin #258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Kotlin: prepare smoke test
  • Loading branch information
Sergey Mashkov committed Aug 6, 2017
commit 63c5556ab6a9c6bca053275ca4fb876cac88fa4e
31 changes: 31 additions & 0 deletions test/executable/source.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Test {
val text1: String = "abc \' def \u0000 \n \" hehe "
val text2: List<Char> = listOf('a', '\n', '\'', '"', '\"')
val numbers = listOf(0, 12, 1.0f, 1.0, 1L, 0x1f, -1, -12, -1.0f, -1.0, -1L)

val template = "abc${1 + "b"}def"
val template2 = "abc${1 + 'b'}def"
val template3 = "abc $var def"

var v: Int = 0

fun function(): ReturnType {
}

fun <T : Any> parametrizedFunction(): T = TODO()

fun references() {
super.references()
this.references()
}

@Annotation
class Annotated

inner class Inner<in T, out E>

object O

companion object {
}
}
21 changes: 21 additions & 0 deletions test/executable/suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,27 @@ def coderay args, options = {}
end
end

context 'highlighting a file without explicit input type (source.kt)' do
source_file = ROOT_DIR + 'test/executable/source.kt'
command = "#{source_file} -html"

source = File.read source_file

pre = %r{<td class="code"><pre>(.*?)</pre>}m
tag_class = /<span class="([^>"]*)"?[^>]*>/

should 'generate json' do
target = coderay("#{source_file} #{source_file}.json")
target = coderay("#{source_file} #{source_file}.html")
end

# should 'respect the file extension and highlight the input as Kotlin' do
# target = coderay(command)
# assert_equal %w(keyword class), target[pre, 1].scan(tag_class).flatten
# end

end

context 'highlighting a file with explicit input and output type (-ruby source.py -span)' do
source_file = ROOT_DIR + 'test/executable/source.py'
command = "-ruby #{source_file} -span"
Expand Down