Sha256: 1344f5fc4fc68c351130928e8cb86b1b15b2b3671fb4820a7bcc7436117142c9
Contents?: true
Size: 880 Bytes
Versions: 8
Compression:
Stored size: 880 Bytes
Contents
# -*- coding: utf-8 -*- require File.join(File.dirname(__FILE__), "..", "spec_helper") describe "Tree Node Dsl Derived Class with no-arg constructor " do class DTreeNode < TreeNode def to_s "dt: #{content}" end end class DLeafNode < LeafNode def to_s "dl: #{content}" end end it "dsl with non-arg constructor" do tree = TreeNode.create(DTreeNode, DLeafNode) do node "root" do leaf "l1" leaf "l2" node "sub" do leaf "l3" end end end # puts tree.to_str out =<<EOS dt: root |-- dl: l1 |-- dl: l2 `-- dt: sub `-- dl: l3 EOS tree.to_str.should == out tree = DTreeNode.create(DLeafNode) do node "root" do leaf "l1" leaf "l2" node "sub" do leaf "l3" end end end tree.to_str.should == out end end
Version data entries
8 entries across 8 versions & 2 rubygems