testforblock ~ ~ ~2 minecraft:comparator
[21:55:59] There is no such block with ID/name comparator
testforblock ~ ~ ~2 404
[21:53:46] The block at 604,1,-168 is tile.comparator.name (expected: tile.air.name).
This is unexpected behavior. Why are comparators not named?
I finally found I need to test for unpowered_comparator and powered_comparator, but it this is not listed in the "name" given in inventory.
Works as intended. You can't have a powered comparator in your inventory, so there's no point in differentiating between the two in the inventory name.