Hello,

Im trying to iterate an array, but its not working.

I have setup a test that looks like this:

def test_getting_component_info
    original = ["1  1  C1  0805,C56p  0805", "2  5  C2,C5,C19,C24,C25
0603,C0.01  0603  50V +/-10%  ECU-V1H103KBV  Panasonic  2011032601"]
    expected = "5\n9"

    assert_equal(expected, get_component_info(original))
  end

The string elements are seperated by tabs.


And here is my method that I am testing:

def get_component_info(bom)
  bom.each { |line|
  line.split("\t").length
  }
end

And here is what the test script says:
<"5\n9"> expected but was
<["1\t1\tC1\t0805,C56p\t0805",
 "2\t5\tC2,C5,C19,C24,C25\t0603,C0.01\t0603\t50V
+/-10%\tECU-V1H103KBV\tPanasonic\t2011032601"]>.

The mehtod seems to be returning the same array that im passing in.
What am I doing wrong?  Without the array iteration Im able to split it
by tabs and do everything but as soon as I put the iteration block,
everything messes up.

Can someone please help.

PS this is my first attempt at TDD.
-- 
Posted via http://www.ruby-forum.com/.