matthiasblaesing commented on a change in pull request #3385:
URL: https://github.com/apache/netbeans/pull/3385#discussion_r775549803



##########
File path: 
ide/lsp.client/test/unit/src/org/netbeans/modules/lsp/client/bindings/FoldManagerImplTest.java
##########
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.lsp.client.bindings;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.swing.text.Document;
+import org.eclipse.lsp4j.FoldingRange;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import org.junit.Test;
+import org.netbeans.editor.BaseDocument;
+import org.netbeans.spi.editor.fold.FoldInfo;
+
+/**
+ * Unit tests for FoldManagerImpl.
+ *
+ * @author MKuettner
+ */
+public class FoldManagerImplTest {
+
+    private static final String EXAMPLE_SIMPLE = "line 1\n"
+            + "line 2\n"
+            + "line 3\n"
+            + "line 4\n"
+            + "line 5\n";
+
+    private static final String EXAMPLE_PY_NEWLINE = "from pattern_imports 
import *\n"
+            + "\n"
+            + "def call(interface):\n"
+            + "    \"\"\"\n"
+            + "    \"\"\"\n"
+            + "    print(\"Dummy call was called!\")\n"
+            + "";
+
+    private static final String EXAMPLE_PY_NO_NEWLINE = "from pattern_imports 
import *\n"
+            + "\n"
+            + "def call(interface):\n"
+            + "    \"\"\"\n"
+            + "    \"\"\"\n"
+            + "    print(\"Dummy call was called!\")";
+
+    @Test
+    public void computeFoldInfosWithoutStartEndCharacterTest() throws 
Exception {
+        Document doc = createDocument(EXAMPLE_SIMPLE);
+
+        List<FoldingRange> ranges = new ArrayList<>();
+        ranges.add(new FoldingRange(0, 2));
+
+        List<FoldInfo> infos = FoldManagerImpl.computeInfos(doc, ranges);
+        assertEquals(1, infos.size());
+        assertEquals(0, infos.get(0).getStart());

Review comment:
       Is this correct? My reading of the documentation indicates, that this 
should be 6 (length of first line):
   
       /**
         * The zero-based character offset from where the folded range starts. 
If
         * not defined, defaults to the length of the start line.
         */
        startCharacter?: uinteger;
   
   If I read that correctly to get a fold, that starts at the beginning of the 
line, you need to explicitly supply the `startCharacter`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to