parsecs 0.11.2 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/libnativemath/extconf.rb +1 -1
- data/lib/parsec.rb +2 -2
- data/test/test_parsec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f31334656fdb4d48c312b6adabb100f74750060454bd21865d35594a340923af
|
4
|
+
data.tar.gz: bfab768c82d4b69dcaf018b63017c1027bd648a6ca4ad036fc4a32b100f41b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67b9d458d4c15c4cc2dde06646ff019d9b8154b75546fb816781a92cf34c71f4d051d23b989799bba4ca0a443ed3c5b233ae4ffdb6c5c53b99e0b02583c8557
|
7
|
+
data.tar.gz: bf3f8a89c3e61852edef6ce8b2489356f9681d362f6709f568969eda34575de35282df78b27cee17010a2ce562e7d9604aef28b11ab3912309e6356fcd231a67
|
@@ -38,7 +38,7 @@ libs.each do |lib|
|
|
38
38
|
end
|
39
39
|
|
40
40
|
GIT_REPOSITORY = 'https://github.com/niltonvasques/equations-parser.git'.freeze
|
41
|
-
COMMIT = '
|
41
|
+
COMMIT = 'd49225cddcf2fb08d8604fc2a7e6198983dcd1b9'.freeze
|
42
42
|
|
43
43
|
Dir.chdir(BASEDIR) do
|
44
44
|
system('git init')
|
data/lib/parsec.rb
CHANGED
@@ -6,7 +6,7 @@ module Parsec
|
|
6
6
|
class Parsec
|
7
7
|
using StringToBooleanRefinements
|
8
8
|
|
9
|
-
VERSION = '0.11.
|
9
|
+
VERSION = '0.11.4'.freeze
|
10
10
|
|
11
11
|
# evaluates the equation and returns only the result
|
12
12
|
def self.eval_equation(equation)
|
@@ -49,7 +49,7 @@ module Parsec
|
|
49
49
|
|
50
50
|
# The following regex remove all spaces that are not between quot marks
|
51
51
|
# https://tinyurl.com/ybc7bng3
|
52
|
-
equation = equation.gsub(/( |(".*?"))/, '\\2') if new_line == true
|
52
|
+
equation = equation.gsub(/( |(".*?[^\\]"))/, '\\2') if new_line == true
|
53
53
|
|
54
54
|
equation
|
55
55
|
end
|
data/test/test_parsec.rb
CHANGED
@@ -56,6 +56,7 @@ class TestParsec < Minitest::Test
|
|
56
56
|
assert_equal('TEST STRING', parser.eval_equation('toupper("test string")'))
|
57
57
|
assert_equal('test string', parser.eval_equation('tolower("TEST STRING")'))
|
58
58
|
assert_equal('Hello World', parser.eval_equation('concat("Hello ", "World")'))
|
59
|
+
assert_equal('tes t "str \" " ing equa " tion', parser.eval_equation('concat(concat("tes t", " \\"str \\\\\" \\" ing "),string("equa \\" tion"))'))
|
59
60
|
assert_equal(5, parser.eval_equation('str2number("5")'))
|
60
61
|
assert_equal(5, parser.eval_equation('number("5")'))
|
61
62
|
assert_equal('Hello', parser.eval_equation('left("Hello World", 5)'))
|
@@ -63,6 +64,7 @@ class TestParsec < Minitest::Test
|
|
63
64
|
assert_equal('<a href="http://foo.bar">Title</a>', parser.eval_equation('link("Title", "http://foo.bar")'))
|
64
65
|
assert_equal('<a href="#">Title</a>', parser.eval_equation('link("Title", "#")'))
|
65
66
|
assert_equal('<a href="/test">Test title</a>', parser.eval_equation('link("Test title", "/test")'))
|
67
|
+
assert_equal('<a href="/test" download="testFileName">Test title</a>', parser.eval_equation('link("Test title", "/test", "testFileName")'))
|
66
68
|
assert_equal(true, parser.eval_equation('contains("Hello World", "orld")'))
|
67
69
|
assert_equal(true, parser.eval_equation('contains("One Flew Over The Cuckoo\'s", "koo")'))
|
68
70
|
assert_equal(false, parser.eval_equation('contains("Hello World", "Worlds")'))
|
@@ -74,8 +76,10 @@ class TestParsec < Minitest::Test
|
|
74
76
|
assert_raises(SyntaxError) { parser.eval_equation('contains(1234567, "789")') }
|
75
77
|
assert_raises(SyntaxError) { parser.eval_equation('contains("hello", 2.2)') }
|
76
78
|
assert_raises(SyntaxError) { parser.eval_equation_with_type('link()') }
|
79
|
+
assert_raises(SyntaxError) { parser.eval_equation_with_type('link("1")') }
|
77
80
|
assert_raises(SyntaxError) { parser.eval_equation_with_type('link(1, 2, 3)') }
|
78
81
|
assert_raises(SyntaxError) { parser.eval_equation_with_type('link(1, "2")') }
|
82
|
+
assert_raises(SyntaxError) { parser.eval_equation_with_type('link("1","2","3","4")') }
|
79
83
|
end
|
80
84
|
|
81
85
|
def test_complex_string_manipulation
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsecs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nilton Vasques
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-09-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest
|