Sha256: c15ff0c70475f93128c941e4428e1ecc3e4bfb732e82aec209ec8d09361fab96
Contents?: true
Size: 1.11 KB
Versions: 10
Compression:
Stored size: 1.11 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), "helper")) class DotVisitorTest < Test::Unit::TestCase def test_var_foo dot = Johnson.parse('var foo;').to_dot assert_equal(3, dot.nodes.length) assert_equal(2, dot.links.length) end def test_for dot = Johnson.parse('for(var x = 0; x < 10; x++) { }').to_dot assert_equal(12, dot.nodes.length) assert_equal(11, dot.links.length) end def test_for_in dot = Johnson.parse('for(var x in johnson(1,2,"asdf")) { }').to_dot assert_equal(11, dot.nodes.length) assert_equal(10, dot.links.length) end def test_try dot = Johnson.parse('try { var x = 10; } finally { var x = 20; }').to_dot assert_equal(12, dot.nodes.length) assert_equal(11, dot.links.length) end def test_try_catch dot = Johnson.parse('try { var x = 10; } catch(a) { var x = 20; x++; }').to_dot assert_equal(16, dot.nodes.length) assert_equal(15, dot.links.length) end def test_function dot = Johnson.parse("var foo = function(a,b) { }").to_dot assert_equal(6, dot.nodes.length) assert_equal(5, dot.links.length) end end
Version data entries
10 entries across 10 versions & 4 rubygems