The test
instruction performs a bitwise AND
, but does not store the result; it only sets the flags.
And jne
is actually "jump if ZF
does not equal 0", so here it's testing if esi
is zero.
Also see How does the `test` instruction work? and What does the `test` instruction do?