public void DoesntMatchBadVariable() { var matchDict2 = "a! = { 'Alice': 7, 'Toby': 'Nuts' }"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchDict2, IronPythonCompletionProvider.dictRegex); Assert.AreEqual(0, matches.Count); }
public void CanMatchBasicNumVarSingleLine() { var matchNumVar = "a = 5.0"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchNumVar, IronPythonCompletionProvider.doubleRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("5.0", matches["a"]); }
public void CanMatchComplexDictVarMultiLine() { var matchDict2 = "\n\na = { 'Alice': 7, 'Toby': 'Nuts' }\nb = 5.0"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchDict2, IronPythonCompletionProvider.dictRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("{ 'Alice': 7, 'Toby': 'Nuts' }", matches["a"]); }
public void CanMatchIntSingleLine() { var matchDict = "a = 2"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchDict, IronPythonCompletionProvider.intRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("2", matches["a"]); }
public void CanMatchBasicArrayVarSingleLine() { var matchArray = "a = []"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchArray, IronPythonCompletionProvider.arrayRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("[]", matches["a"]); }
public void CanMatchBasicDictVarSingleLine() { var matchDict = "a = {}"; var matches = IronPythonCompletionProvider.FindVariableStatementWithRegex(matchDict, PythonCodeCompletionProviderCommon.dictRegex); Assert.AreEqual(1, matches.Count); Assert.IsTrue(matches.ContainsKey("a")); Assert.AreEqual("{}", matches["a"]); }