Skip to content

Instantly share code, notes, and snippets.

@chappy84
Last active December 10, 2015 13:39
Show Gist options
  • Save chappy84/4442437 to your computer and use it in GitHub Desktop.
Save chappy84/4442437 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Usage: convert_assertions.sh file1 file2 ...
perl -i -p \
-e 's/assertEquals?/assertEquals/g;' \
-e 's/assertNotEquals?/assertNotEquals/g;' \
-e 's/assertPattern/assertRegExp/g;' \
-e 's/assertIdentical/assertSame/g;' \
-e 's/assertNotIdentical/assertNotSame/g;' \
-e 's/assertNoPattern/assertNotRegExp/g;' \
-e 's/assertReference/assertSame/g;' \
-e 's/assertClone/assertEquals/g;' \
-e 's/assertIsA\((\S+), *(\S+)\)/assertInstanceOf(\2, \1)/g;' \
-e 's/skipIf\(\s*true\s*, *(.+)\)/markTestSkipped(\1)/g;' \
-e 's/expectException/setExpectedException/g;' \
"$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment