Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions lib/languages/red.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!e
;\p
Red [\pj-->>]\pj
Red +[\pj-->>]\pj
comment [\pj-->>]\pj
comment +[\pj-->>]\pj
comment {\pj-->>}\pj
comment +{\pj-->>}\pj
49 changes: 49 additions & 0 deletions test/languages/red_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require "test_helper"

module SnippetExtractor
module Languages
class RedTest < Minitest::Test
def test_full_example
code = <<~CODE
Red [a-header] ; a comment

; single line comment
x: 1 ; line comment 1
y: 11
x: 2 ;-- line comment 2
x: 3 ;@@ line comment 3

comment ['this
'is 'multiline
'comment]

print "no comments!"

comment {and this
as well}

function add100 [x [integer!]] [
" this should not count as comment "
{ and neither
this }
]
CODE

expected = <<~CODE
x: 1
y: 11
x: 2
x: 3

print "no comments!"

function add100 [x [integer!]] [
" this should not count as comment "
{ and neither
CODE

assert_equal expected, ExtractSnippet.(code, :red)
end
end
end
end