зеркало из https://github.com/mozilla/gecko-dev.git
Bug 928566: Use more descriptive parameter names in robocop assertion methods. r=gbrown
This commit is contained in:
Родитель
61c21da3fc
Коммит
18f3101a2a
|
@ -12,11 +12,11 @@ public interface Assert {
|
|||
void endTest();
|
||||
|
||||
void ok(boolean condition, String name, String diag);
|
||||
void is(Object a, Object b, String name);
|
||||
void isnot(Object a, Object b, String name);
|
||||
void is(Object actual, Object expected, String name);
|
||||
void isnot(Object actual, Object notExpected, String name);
|
||||
void todo(boolean condition, String name, String diag);
|
||||
void todo_is(Object a, Object b, String name);
|
||||
void todo_isnot(Object a, Object b, String name);
|
||||
void todo_is(Object actual, Object expected, String name);
|
||||
void todo_isnot(Object actual, Object notExpected, String name);
|
||||
void info(String name, String message);
|
||||
|
||||
// robocop-specific asserts
|
||||
|
|
|
@ -15,7 +15,7 @@ public class FennecMochitestAssert implements Assert {
|
|||
private int mPassed = 0;
|
||||
private int mFailed = 0;
|
||||
private int mTodo = 0;
|
||||
|
||||
|
||||
// Used to write the first line of the test file
|
||||
private boolean mLogStarted = false;
|
||||
|
||||
|
@ -140,14 +140,14 @@ public class FennecMochitestAssert implements Assert {
|
|||
mTestList.add(test);
|
||||
}
|
||||
|
||||
public void is(Object a, Object b, String name) {
|
||||
boolean pass = checkObjectsEqual(a,b);
|
||||
ok(pass, name, getEqualString(a,b, pass));
|
||||
public void is(Object actual, Object expected, String name) {
|
||||
boolean pass = checkObjectsEqual(actual, expected);
|
||||
ok(pass, name, getEqualString(actual, expected, pass));
|
||||
}
|
||||
|
||||
public void isnot(Object a, Object b, String name) {
|
||||
boolean pass = checkObjectsNotEqual(a,b);
|
||||
ok(pass, name, getNotEqualString(a,b,pass));
|
||||
|
||||
public void isnot(Object actual, Object notExpected, String name) {
|
||||
boolean pass = checkObjectsNotEqual(actual, notExpected);
|
||||
ok(pass, name, getNotEqualString(actual, notExpected, pass));
|
||||
}
|
||||
|
||||
public void ispixel(int actual, int r, int g, int b, String name) {
|
||||
|
@ -197,14 +197,14 @@ public class FennecMochitestAssert implements Assert {
|
|||
mTestList.add(test);
|
||||
}
|
||||
|
||||
public void todo_is(Object a, Object b, String name) {
|
||||
boolean pass = checkObjectsEqual(a,b);
|
||||
todo(pass, name, getEqualString(a,b,pass));
|
||||
public void todo_is(Object actual, Object expected, String name) {
|
||||
boolean pass = checkObjectsEqual(actual, expected);
|
||||
todo(pass, name, getEqualString(actual, expected, pass));
|
||||
}
|
||||
|
||||
public void todo_isnot(Object a, Object b, String name) {
|
||||
boolean pass = checkObjectsNotEqual(a,b);
|
||||
todo(pass, name, getNotEqualString(a,b,pass));
|
||||
public void todo_isnot(Object actual, Object notExpected, String name) {
|
||||
boolean pass = checkObjectsNotEqual(actual, notExpected);
|
||||
todo(pass, name, getNotEqualString(actual, notExpected, pass));
|
||||
}
|
||||
|
||||
private boolean checkObjectsEqual(Object a, Object b) {
|
||||
|
|
|
@ -6,7 +6,7 @@ package org.mozilla.gecko;
|
|||
|
||||
|
||||
public class FennecTalosAssert implements Assert {
|
||||
|
||||
|
||||
public FennecTalosAssert() { }
|
||||
|
||||
/**
|
||||
|
@ -38,14 +38,14 @@ public class FennecTalosAssert implements Assert {
|
|||
}
|
||||
}
|
||||
|
||||
public void is(Object a, Object b, String name) {
|
||||
boolean pass = (a == null ? b == null : a.equals(b));
|
||||
ok(pass, name, "got " + a + ", expected " + b);
|
||||
public void is(Object actual, Object expected, String name) {
|
||||
boolean pass = (actual == null ? expected == null : actual.equals(expected));
|
||||
ok(pass, name, "got " + actual + ", expected " + expected);
|
||||
}
|
||||
|
||||
public void isnot(Object a, Object b, String name) {
|
||||
boolean fail = (a == null ? b == null : a.equals(b));
|
||||
ok(!fail, name, "got " + a + ", expected not " + b);
|
||||
|
||||
public void isnot(Object actual, Object notExpected, String name) {
|
||||
boolean fail = (actual == null ? notExpected == null : actual.equals(notExpected));
|
||||
ok(!fail, name, "got " + actual + ", expected not " + notExpected);
|
||||
}
|
||||
|
||||
public void ispixel(int actual, int r, int g, int b, String name) {
|
||||
|
@ -60,11 +60,11 @@ public class FennecTalosAssert implements Assert {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void todo_is(Object a, Object b, String name) {
|
||||
public void todo_is(Object actual, Object expected, String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void todo_isnot(Object a, Object b, String name) {
|
||||
public void todo_isnot(Object actual, Object notExpected, String name) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче