Tests on add global quickfix added

This commit is contained in:
Oleg Shpynov
2010-03-10 18:53:42 +03:00
parent c8c1da4d25
commit 146275bd78
5 changed files with 45 additions and 0 deletions
@@ -0,0 +1,9 @@
a = 1
def foo():
global b
print <caret><warning descr="Local variable 'a' referenced before assignment">a</warning>
a = 2
print a
foo()
@@ -0,0 +1,9 @@
a = 1
def foo():
global b, a
print a
a = 2
print a
foo()
@@ -0,0 +1,8 @@
a = 1
def foo():
print <caret><warning descr="Local variable 'a' referenced before assignment">a</warning>
a = 2
print a
foo()
@@ -0,0 +1,9 @@
a = 1
def foo():
global a
print a
a = 2
print a
foo()
@@ -97,6 +97,16 @@ public class PyQuickFixTest extends PyLightFixtureTestCase {
PyBundle.message("QFIX.classic.class.transform"), true, true);
}
public void testAddGlobalQuickFix() throws Exception {
doInspectionTest("AddGlobalStatement.py", PyUnboundLocalVariableInspection.class,
PyBundle.message("QFIX.add.global"), true, true);
}
public void testAddGlobalExistingQuickFix() throws Exception {
doInspectionTest("AddGlobalExistingStatement.py", PyUnboundLocalVariableInspection.class,
PyBundle.message("QFIX.add.global"), true, true);
}
protected void doInspectionTest(@NonNls String testFileName,
final Class inspectionClass,
@NonNls String quickFixName,