aboutsummaryrefslogtreecommitdiff
path: root/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'ruby')
-rw-r--r--ruby/Makefile2
-rw-r--r--ruby/step9_try.rb (renamed from ruby/stepA_more.rb)0
-rw-r--r--ruby/stepA_interop.rb (renamed from ruby/step9_interop.rb)0
-rw-r--r--ruby/tests/stepA_interop.mal27
4 files changed, 28 insertions, 1 deletions
diff --git a/ruby/Makefile b/ruby/Makefile
index 71ab92c..f9792f5 100644
--- a/ruby/Makefile
+++ b/ruby/Makefile
@@ -1,7 +1,7 @@
TESTS =
SOURCES_BASE = mal_readline.rb types.rb reader.rb printer.rb
-SOURCES_LISP = env.rb core.rb stepA_more.rb
+SOURCES_LISP = env.rb core.rb stepA_interop.rb
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
#all: mal.rb
diff --git a/ruby/stepA_more.rb b/ruby/step9_try.rb
index 6123293..6123293 100644
--- a/ruby/stepA_more.rb
+++ b/ruby/step9_try.rb
diff --git a/ruby/step9_interop.rb b/ruby/stepA_interop.rb
index 6d2cbe2..6d2cbe2 100644
--- a/ruby/step9_interop.rb
+++ b/ruby/stepA_interop.rb
diff --git a/ruby/tests/stepA_interop.mal b/ruby/tests/stepA_interop.mal
new file mode 100644
index 0000000..2d7efb8
--- /dev/null
+++ b/ruby/tests/stepA_interop.mal
@@ -0,0 +1,27 @@
+;; Testing basic ruby interop
+
+(rb* "7")
+;=>7
+
+(rb* "'7'")
+;=>"7"
+
+(rb* "[7,8,9]")
+;=>(7 8 9)
+
+(rb* "{\"abc\" => 789}")
+;=>{"abc" 789}
+
+(rb* "print 'hello\n'")
+; hello
+;=>nil
+
+(rb* "$foo=8;")
+(rb* "$foo")
+;=>8
+
+(rb* "['a','b','c'].map{|x| 'X'+x+'Y'}.join(' ')")
+;=>"XaY XbY XcY"
+
+(rb* "[1,2,3].map{|x| 1+x}")
+;=>(2 3 4)