Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/pyduchaintest.cpp
Show First 20 Lines • Show All 1387 Lines • ▼ Show 20 Line(s) | 1354 | { | |||
---|---|---|---|---|---|
1388 | QTest::newRow("subscript_multi") << | 1388 | QTest::newRow("subscript_multi") << | ||
1389 | "class Middle:\n def __getitem__(self, key):\n return str()\n" | 1389 | "class Middle:\n def __getitem__(self, key):\n return str()\n" | ||
1390 | "class Outer:\n def __getitem__(self, key):\n return Middle()\n" | 1390 | "class Outer:\n def __getitem__(self, key):\n return Middle()\n" | ||
1391 | "aaa = Outer()\ncheckme = aaa[0][0]" << "str" << true; | 1391 | "aaa = Outer()\ncheckme = aaa[0][0]" << "str" << true; | ||
1392 | QTest::newRow("subscript_func_call") << | 1392 | QTest::newRow("subscript_func_call") << | ||
1393 | "class Foo:\n def __getitem__(self, key):\n return str()\n" | 1393 | "class Foo:\n def __getitem__(self, key):\n return str()\n" | ||
1394 | "def bar():\n return Foo()\n" | 1394 | "def bar():\n return Foo()\n" | ||
1395 | "checkme = bar()[0]" << "str" << true; | 1395 | "checkme = bar()[0]" << "str" << true; | ||
1396 | QTest::newRow("subscript_unknown_index") << "a = 1,str()\ncheckme = a[5-4]" << "unsure (int, str)" << true; | ||||
1397 | QTest::newRow("subscript_unsure") << "a = 1,2\na=[str()]\ncheckme = a[0]" << "unsure (int, str)" << true; | ||||
1398 | QTest::newRow("subscript_unsure_getitem") << | ||||
1399 | "class Foo:\n def __getitem__(self, key):\n return str()\n" | ||||
1400 | "class Bar:\n def __getitem__(self, key):\n return float()\n" | ||||
1401 | "a = Foo()\na=Bar()\na=[1,2]\ncheckme = a[1]" << "unsure (str, float, int)" << true; | ||||
1396 | } | 1402 | } | ||
1397 | 1403 | | |||
1398 | void PyDUChainTest::testVariableCreation() | 1404 | void PyDUChainTest::testVariableCreation() | ||
1399 | { | 1405 | { | ||
1400 | QFETCH(QString, code); | 1406 | QFETCH(QString, code); | ||
1401 | QFETCH(QStringList, expected_local_declarations); | 1407 | QFETCH(QStringList, expected_local_declarations); | ||
1402 | QFETCH(QStringList, expected_types); | 1408 | QFETCH(QStringList, expected_types); | ||
1403 | 1409 | | |||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |