<NME> ElmStructureViewTest.kt
<BEF> ADDFILE
<MSG> Support destructuring and nested declarations in structure view (#556)

Previously, only top level declarations were shown, and destructuring declarations only showed the name of the first declared value.
<DFF> @@ -0,0 +1,80 @@
+package org.elm.ide.structure
+
+import com.intellij.testFramework.PlatformTestUtil
+import org.elm.lang.ElmTestBase
+import org.intellij.lang.annotations.Language
+
+internal class ElmStructureViewTest : ElmTestBase() {
+    fun `test top-level declarations`() = doTest("""
+type alias Alias = ()
+type Foo = Bar
+main = 1
+""", """
+-Main.elm
+ Alias
+ Foo
+ main
+""")
+
+    fun `test destructuring declaration`() = doTest("""
+(foo, bar) = (1, 2)
+""", """
+-Main.elm
+ foo, bar
+""")
+
+    fun `test nested value declaration`() = doTest("""
+main =
+  let foo = 1 in foo
+""", """
+-Main.elm
+ -main
+  foo
+""")
+
+    fun `test nested value declarations in tuple`() = doTest("""
+main =
+  (
+  let foo = 1 in foo,
+  let bar = 2 in bar
+  )
+""", """
+-Main.elm
+ -main
+  foo
+  bar
+""")
+
+    fun `test deeply nested value declarations`() = doTest("""
+main =
+  let
+    level1 =
+      let
+        level2a = 1
+        level2b =
+          let
+            level3a = 1
+            level3b = 2
+          in
+          level3b
+      in
+      level2b
+  in
+  level1
+""", """
+-Main.elm
+ -main
+  -level1
+   level2a
+   -level2b
+    level3a
+    level3b
+""")
+    private fun doTest(@Language("Elm") code: String, expected: String) {
+        myFixture.configureByText("Main.elm", code)
+        myFixture.testStructureView {
+            PlatformTestUtil.expandAll(it.tree)
+            PlatformTestUtil.assertTreeEqual(it.tree, expected)
+        }
+    }
+}

Support destructuring and nested declarations in structure view (#556)