This is the entire point of the plot of The Pirates of Penzance. In addition to the do-nothing-ness and ethics of the pirates, Frederic swears himself to killing all of his friends once his indenture is over because piracy is wrong. He interrupts the Major General's daughters stripping on the beach due to uh, honor. And when the Pirate King and Ruth reveal that due to his birthday, he's going to be indentured until 1940, they don't even try to enforce it on him — "we leave it to your honor."
Stripping? They intend to paddle in the water. So — take their shoes and socks off. Probably pull up their skirts a little, too. Then, he is a slave to duty.
But—bare ankles! Scandalous!
At the end the pirates themselves surrender when called upon to do so in Queen Victoria's name.
Arguably, this is the tragic flaw of Brutus in William Shakespeare's Julius Caesar - he doesn't want to accept that the people around him are not as idealistic and honorable as he is.
In Camelot, this is the fork Arthur finds himself caught on when Guinevere is caught with Lancelot. As Mordred says: "Let her die, your life is over; let her live, your life's a fraud. Which will it be — kill the queen or kill the law?"
Features prominently in Victor Hugo's play Hernani and its opera adaptation, Ernani—a rather extreme case of I Gave My Word.
This is the central theme of A Man for All Seasons - Thomas More could easily save himself, but that would come at the cost of his integrity, something he is not willing to give.