test/RubyLess/basic.yml in rubyless-0.4.0 vs test/RubyLess/basic.yml in rubyless-0.5.0
- old
+ new
@@ -20,14 +20,10 @@
symbol:
src: ":foobar"
sxp: 's(:lit, :foobar)'
-hash_access:
- src: "dictionary[:key]"
- tem: "get_dict[:key]"
-
rewrite_variables:
src: "!prev.ancestor?(main) && !node.ancestor?(main)"
tem: "(not previous.ancestor?(@node) and not node.ancestor?(@node))"
method_can_return_nil:
@@ -136,6 +132,56 @@
src: "log_info(sub, 'hello')"
tem: "log_info(sub, \"hello\")"
optional_argument_subclass:
src: "width(:mode => str)"
- tem: "node.width({:mode => str})"
+ tem: "node.width({:mode => str})"
+
+simple_accept_nil:
+ src: "accept_nil(dictionary[:foo])"
+ tem: "accept_nil(get_dict[:foo])"
+
+accept_nil_many_arguments:
+ src: "accept_nil(dictionary[:foo], dictionary[:bar])"
+ tem: "accept_nil(get_dict[:foo], get_dict[:bar])"
+ res: "[\"Foo\", nil]"
+
+accept_nil_many_arguments_no_all_nil:
+ src: "accept_nil('hop', dictionary[:bar])"
+ tem: "accept_nil(\"hop\", get_dict[:bar])"
+ res: "[\"hop\", nil]"
+
+no_nil_in_accept_nil:
+ src: "accept_nil(no_nil(dictionary[:foo]))"
+ tem: "accept_nil((get_dict[:foo] ? no_nil(get_dict[:foo]) : nil))"
+ res: "[\"Foo\", nil]"
+
+two_no_nil_in_accept_nil:
+ src: "accept_nil(no_nil(dictionary[:foo]), no_nil(dictionary[:bar]))"
+ tem: "accept_nil((get_dict[:foo] ? no_nil(get_dict[:foo]) : nil), (get_dict[:bar] ? no_nil(get_dict[:bar]) : nil))"
+ res: "[\"Foo\", nil]"
+
+accept_nil_in_no_nil:
+ src: "no_nil(accept_nil(dictionary[:foo]))"
+ tem: "no_nil(accept_nil(get_dict[:foo]))"
+
+parse_array:
+ src: "[3, 6]"
+ tem: '[3,6]'
+
+noop_method:
+ src: 'no_op("hello")'
+ tem: '("hello")'
+ res: 'hello'
+
+noop_other_signature:
+ src: 'no_op(45)'
+ tem: 'transform(45)'
+
+build_finder:
+ # This test shows a way to 'pre_process' literal content with a helper method that should return a TypedString
+ src: 'find("one two")'
+ tem: 'secure(Node) { Node.find("one two") }'
+
+methods_on_nil:
+ src: 'dictionary[:foo].blank?'
+ tem: 'get_dict[:foo].blank?'
\ No newline at end of file