comment_strip-ruby 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/comment_strip/language_families/c.rb +159 -137
- data/lib/comment_strip/language_families/hash_line.rb +211 -0
- data/lib/comment_strip/strip.rb +24 -12
- data/lib/comment_strip/version.rb +7 -8
- data/test/unit/{tc_strip.rb → tc_strip_c.rb} +262 -232
- data/test/unit/tc_strip_hash_line.rb +95 -0
- data/test/unit/ts_all.rb +1 -1
- metadata +16 -15
@@ -0,0 +1,95 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.join(__dir__, '../..', 'lib')
|
4
|
+
|
5
|
+
|
6
|
+
require 'comment_strip'
|
7
|
+
|
8
|
+
require 'xqsr3/extensions/test/unit'
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
|
12
|
+
class Test_HashLine_strip_1 < Test::Unit::TestCase
|
13
|
+
|
14
|
+
include ::CommentStrip
|
15
|
+
|
16
|
+
def test_nil
|
17
|
+
|
18
|
+
assert_nil strip(nil, :Hash_Line)
|
19
|
+
|
20
|
+
assert_nil ::CommentStrip.strip(nil, :Hash_Line)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_empty
|
24
|
+
|
25
|
+
assert_equal "", strip('', :Hash_Line)
|
26
|
+
assert_equal "", ::CommentStrip.strip('', :Hash_Line)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_code_with_single_line_no_comment
|
30
|
+
|
31
|
+
input = <<-EOF
|
32
|
+
x=1
|
33
|
+
EOF
|
34
|
+
expected = <<-EOF
|
35
|
+
x=1
|
36
|
+
EOF
|
37
|
+
|
38
|
+
actual = strip(input, :Hash_Line)
|
39
|
+
|
40
|
+
assert_equal expected, actual
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_code_with_multiple_lines_no_comments
|
44
|
+
|
45
|
+
input = <<-EOF
|
46
|
+
x=1
|
47
|
+
y="abc"
|
48
|
+
z=`pwd`
|
49
|
+
EOF
|
50
|
+
expected = <<-EOF
|
51
|
+
x=1
|
52
|
+
y="abc"
|
53
|
+
z=`pwd`
|
54
|
+
EOF
|
55
|
+
|
56
|
+
actual = strip(input, :Hash_Line)
|
57
|
+
|
58
|
+
assert_equal expected, actual
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_code_with_single_line_and_comment
|
62
|
+
|
63
|
+
input = <<-EOF
|
64
|
+
x=1 # x=1
|
65
|
+
EOF
|
66
|
+
expected = <<-EOF
|
67
|
+
x=1
|
68
|
+
EOF
|
69
|
+
|
70
|
+
actual = strip(input, :Hash_Line)
|
71
|
+
|
72
|
+
assert_equal expected, actual
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_code_with_multiple_lines_and_comments
|
76
|
+
|
77
|
+
input = <<-EOF
|
78
|
+
x=1#x=1
|
79
|
+
y="abc"
|
80
|
+
z=`pwd` # comment
|
81
|
+
EOF
|
82
|
+
expected = <<-EOF
|
83
|
+
x=1
|
84
|
+
y="abc"
|
85
|
+
z=`pwd`
|
86
|
+
EOF
|
87
|
+
|
88
|
+
actual = strip(input, :Hash_Line)
|
89
|
+
|
90
|
+
assert_equal expected, actual
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# ############################## end of file ############################# #
|
95
|
+
|
data/test/unit/ts_all.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comment_strip-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xqsr3
|
@@ -16,21 +16,17 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 0.37.2
|
19
|
+
version: '0.38'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
description: "Source code comment stripping library\n\n"
|
26
|
+
version: '0.38'
|
27
|
+
description: 'Source code comment stripping library
|
28
|
+
|
29
|
+
'
|
34
30
|
email: matthew@synesis.com.au
|
35
31
|
executables: []
|
36
32
|
extensions: []
|
@@ -40,10 +36,12 @@ files:
|
|
40
36
|
- README.md
|
41
37
|
- lib/comment_strip.rb
|
42
38
|
- lib/comment_strip/language_families/c.rb
|
39
|
+
- lib/comment_strip/language_families/hash_line.rb
|
43
40
|
- lib/comment_strip/strip.rb
|
44
41
|
- lib/comment_strip/version.rb
|
45
42
|
- test/scratch/ex1.rb
|
46
|
-
- test/unit/
|
43
|
+
- test/unit/tc_strip_c.rb
|
44
|
+
- test/unit/tc_strip_hash_line.rb
|
47
45
|
- test/unit/tc_version.rb
|
48
46
|
- test/unit/ts_all.rb
|
49
47
|
homepage: https://github.com/synesissoftware/comment_strip.r
|
@@ -56,16 +54,19 @@ require_paths:
|
|
56
54
|
- lib
|
57
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
56
|
requirements:
|
59
|
-
- - "
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.0'
|
60
|
+
- - "<"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
+
version: '4'
|
62
63
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
64
|
requirements:
|
64
65
|
- - ">="
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: '0'
|
67
68
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.2.15
|
69
70
|
signing_key:
|
70
71
|
specification_version: 4
|
71
72
|
summary: comment_strip.r
|