This repository was archived by the owner on Nov 12, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
main/java/com/searchcode/app/util
test/java/com/searchcode/app/util Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1010
1111package com .searchcode .app .util ;
1212
13- import com .searchcode .app .dto .CodeIndexDocument ;
1413import com .searchcode .app .dto .FileClassifierResult ;
1514import com .searchcode .app .service .Singleton ;
1615
Original file line number Diff line number Diff line change @@ -118,6 +118,36 @@ public void testCPlusPlus() {
118118 assertThat (slocCount .blankCount ).isEqualTo (4 );
119119 }
120120
121+ public void testRuby () {
122+ String language = "Ruby" ;
123+ String contents = "# 20 lines 9 code 8 comments 3 blanks\n " +
124+ "x = 3\n " +
125+ "if x < 2\n " +
126+ " p = \" Smaller\" \n " +
127+ "else\n " +
128+ " p = \" Bigger\" \n " +
129+ "end\n " +
130+ "\n " +
131+ "=begin\n " +
132+ " Comments\n " +
133+ " Comments\n " +
134+ " Comments\n " +
135+ " Comments\n " +
136+ "=end\n " +
137+ "\n " +
138+ "# testing.\n " +
139+ "while x > 2 and x < 10\n " +
140+ " x += 1\n " +
141+ "end\n " +
142+ "\n " ;
143+
144+ SlocCounter .SlocCount slocCount = this .slocCounter .countStats (contents , language );
145+ assertThat (slocCount .linesCount ).isEqualTo (20 );
146+ assertThat (slocCount .codeCount ).isEqualTo (9 );
147+ assertThat (slocCount .commentCount ).isEqualTo (8 );
148+ assertThat (slocCount .blankCount ).isEqualTo (3 );
149+ }
150+
121151 public void testTokeiTest () {
122152 String language = "Rust" ;
123153 String contents = "// 39 lines 32 code 2 comments 5 blanks\n " +
You can’t perform that action at this time.
0 commit comments