summaryrefslogtreecommitdiff
path: root/tests/snippets/ruby
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2021-01-20 10:57:30 +0100
committerGeorg Brandl <georg@python.org>2021-01-20 10:57:30 +0100
commitb40b0cca067c2e9c2f69c91abbd27e79ad243b42 (patch)
tree6f81b370c551ea06e89ff8333b5939df5625e757 /tests/snippets/ruby
parentdc9bf0c256dbd88c72349822d59b25f9d8225dc6 (diff)
downloadpygments-git-b40b0cca067c2e9c2f69c91abbd27e79ad243b42.tar.gz
Rename "tests/lexers" to "tests/snippets" and update the contribution
docs to point to both snippets and examplefiles.
Diffstat (limited to 'tests/snippets/ruby')
-rw-r--r--tests/snippets/ruby/test_escaped_bracestring.txt19
-rw-r--r--tests/snippets/ruby/test_interpolation_nested_curly.txt56
-rw-r--r--tests/snippets/ruby/test_operator_methods.txt9
-rw-r--r--tests/snippets/ruby/test_range_syntax1.txt8
-rw-r--r--tests/snippets/ruby/test_range_syntax2.txt8
-rw-r--r--tests/snippets/ruby/test_range_syntax3.txt10
6 files changed, 110 insertions, 0 deletions
diff --git a/tests/snippets/ruby/test_escaped_bracestring.txt b/tests/snippets/ruby/test_escaped_bracestring.txt
new file mode 100644
index 00000000..7bcf845e
--- /dev/null
+++ b/tests/snippets/ruby/test_escaped_bracestring.txt
@@ -0,0 +1,19 @@
+---input---
+str.gsub(%r{\\\\}, "/")
+
+---tokens---
+'str' Name
+'.' Operator
+'gsub' Name
+'(' Punctuation
+'%r{' Literal.String.Regex
+'\\\\' Literal.String.Regex
+'\\\\' Literal.String.Regex
+'}' Literal.String.Regex
+',' Punctuation
+' ' Text
+'"' Literal.String.Double
+'/' Literal.String.Double
+'"' Literal.String.Double
+')' Punctuation
+'\n' Text
diff --git a/tests/snippets/ruby/test_interpolation_nested_curly.txt b/tests/snippets/ruby/test_interpolation_nested_curly.txt
new file mode 100644
index 00000000..eceb04af
--- /dev/null
+++ b/tests/snippets/ruby/test_interpolation_nested_curly.txt
@@ -0,0 +1,56 @@
+---input---
+"A#{ (3..5).group_by { |x| x/2}.map do |k,v| "#{k}" end.join }" + "Z"
+
+---tokens---
+'"' Literal.String.Double
+'A' Literal.String.Double
+'#{' Literal.String.Interpol
+' ' Text
+'(' Punctuation
+'3' Literal.Number.Integer
+'..' Operator
+'5' Literal.Number.Integer
+')' Punctuation
+'.' Operator
+'group_by' Name
+' ' Text
+'{' Literal.String.Interpol
+' ' Text
+'|' Operator
+'x' Name
+'|' Operator
+' ' Text
+'x' Name
+'/' Operator
+'2' Literal.Number.Integer
+'}' Literal.String.Interpol
+'.' Operator
+'map' Name
+' ' Text
+'do' Keyword
+' ' Text
+'|' Operator
+'k' Name
+',' Punctuation
+'v' Name
+'|' Operator
+' ' Text
+'"' Literal.String.Double
+'#{' Literal.String.Interpol
+'k' Name
+'}' Literal.String.Interpol
+'"' Literal.String.Double
+' ' Text
+'end' Keyword
+'.' Operator
+'join' Name
+' ' Text
+'}' Literal.String.Interpol
+'"' Literal.String.Double
+' ' Text
+'+' Operator
+' ' Text
+'"' Literal.String.Double
+'Z' Literal.String.Double
+'"' Literal.String.Double
+'\n' Text
diff --git a/tests/snippets/ruby/test_operator_methods.txt b/tests/snippets/ruby/test_operator_methods.txt
new file mode 100644
index 00000000..f444ee4f
--- /dev/null
+++ b/tests/snippets/ruby/test_operator_methods.txt
@@ -0,0 +1,9 @@
+---input---
+x.==4
+
+---tokens---
+'x' Name
+'.' Operator
+'==' Name.Operator
+'4' Literal.Number.Integer
+'\n' Text
diff --git a/tests/snippets/ruby/test_range_syntax1.txt b/tests/snippets/ruby/test_range_syntax1.txt
new file mode 100644
index 00000000..df7c40cb
--- /dev/null
+++ b/tests/snippets/ruby/test_range_syntax1.txt
@@ -0,0 +1,8 @@
+---input---
+1..3
+
+---tokens---
+'1' Literal.Number.Integer
+'..' Operator
+'3' Literal.Number.Integer
+'\n' Text
diff --git a/tests/snippets/ruby/test_range_syntax2.txt b/tests/snippets/ruby/test_range_syntax2.txt
new file mode 100644
index 00000000..72d47e85
--- /dev/null
+++ b/tests/snippets/ruby/test_range_syntax2.txt
@@ -0,0 +1,8 @@
+---input---
+1...3
+
+---tokens---
+'1' Literal.Number.Integer
+'...' Operator
+'3' Literal.Number.Integer
+'\n' Text
diff --git a/tests/snippets/ruby/test_range_syntax3.txt b/tests/snippets/ruby/test_range_syntax3.txt
new file mode 100644
index 00000000..a72f8380
--- /dev/null
+++ b/tests/snippets/ruby/test_range_syntax3.txt
@@ -0,0 +1,10 @@
+---input---
+1 .. 3
+
+---tokens---
+'1' Literal.Number.Integer
+' ' Text
+'..' Operator
+' ' Text
+'3' Literal.Number.Integer
+'\n' Text