sexpistol 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +30 -0
- data/.gitignore +3 -1
- data/.rspec +2 -0
- data/.rubocop.yml +27 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +61 -0
- data/MIT-LICENSE +1 -1
- data/README.md +135 -0
- data/lib/sexpistol/parser.rb +49 -0
- data/lib/sexpistol/s_expression_array.rb +6 -0
- data/lib/sexpistol/version.rb +5 -0
- data/lib/sexpistol.rb +53 -2
- data/sexpistol.gemspec +25 -64
- metadata +87 -83
- data/README.rdoc +0 -89
- data/Rakefile +0 -42
- data/VERSION +0 -1
- data/lib/sexpistol/sexpistol.rb +0 -76
- data/lib/sexpistol/sexpistol_parser.rb +0 -64
- data/test/performance/benchmark_test.rb +0 -46
- data/test/setup/test_unit_extensions.rb +0 -21
- data/test/test_helper.rb +0 -10
- data/test/unit/float_literal_test.rb +0 -40
- data/test/unit/integer_literal_test.rb +0 -24
- data/test/unit/ruby_keyword_literals_test.rb +0 -45
- data/test/unit/scheme_compatability_test.rb +0 -46
- data/test/unit/string_literal_test.rb +0 -39
- data/test/unit/structure_test.rb +0 -30
- data/test/unit/symbol_test.rb +0 -74
- data/test/unit/to_sexp_test.rb +0 -51
data/test/unit/to_sexp_test.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))
|
2
|
-
|
3
|
-
class ToSexpTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@parser = Sexpistol.new
|
7
|
-
end
|
8
|
-
|
9
|
-
test "should convert nested arrays back into an S-Expression" do
|
10
|
-
ast = [:string, [:is, [:parsed]]]
|
11
|
-
sexp = @parser.to_sexp(ast)
|
12
|
-
assert_equal "(string (is (parsed)))", sexp
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should structure containing integers and strings back into an S-Expression" do
|
16
|
-
ast = ["String!", [1, [2, "Other string."]]]
|
17
|
-
sexp = @parser.to_sexp(ast)
|
18
|
-
assert_equal "(String! (1 (2 Other string.)))", sexp
|
19
|
-
end
|
20
|
-
|
21
|
-
test "should not output true and false using scheme notation when scheme compat is off" do
|
22
|
-
ast = [true, [false, [true, false]]]
|
23
|
-
sexp = @parser.to_sexp(ast)
|
24
|
-
assert_equal "(true (false (true false)))", sexp
|
25
|
-
end
|
26
|
-
|
27
|
-
test "when not passed array to_sexp should print value (integer)" do
|
28
|
-
ast = 1
|
29
|
-
sexp = @parser.to_sexp(ast)
|
30
|
-
assert_equal "1", sexp
|
31
|
-
end
|
32
|
-
|
33
|
-
test "when not passed array to_sexp should print value (string)" do
|
34
|
-
ast = "test"
|
35
|
-
sexp = @parser.to_sexp(ast)
|
36
|
-
assert_equal "test", sexp
|
37
|
-
end
|
38
|
-
|
39
|
-
test "when not passed array to_sexp should print value (symbol)" do
|
40
|
-
ast = :test
|
41
|
-
sexp = @parser.to_sexp(ast)
|
42
|
-
assert_equal "test", sexp
|
43
|
-
end
|
44
|
-
|
45
|
-
test "lists passed to to_sexp should have not extraneous spaces" do
|
46
|
-
ast = [1, 2, 3]
|
47
|
-
sexp = @parser.to_sexp(ast)
|
48
|
-
assert_equal "(1 2 3)", sexp
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|