(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description spids:[21])
          op: Equal
          rhs: {(SQ <'git apply submodule tests'>)}
          spids: [21]
        )
      ]
      spids: [21]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(setup)} 
      {
        (SQ <'\n'> <'\tcat > create-sm.patch <<EOF &&\n'> <'diff --git a/dir/sm b/dir/sm\n'> 
          <'new file mode 160000\n'> <'index 0000000..0123456\n'> <'--- /dev/null\n'> <'+++ b/dir/sm\n'> <'@@ -0,0 +1 @@\n'> 
          <'+Subproject commit 0123456789abcdef0123456789abcdef01234567\n'> <'EOF\n'> <'\tcat > remove-sm.patch <<EOF\n'> <'diff --git a/dir/sm b/dir/sm\n'> 
          <'deleted file mode 160000\n'> <'index 0123456..0000000\n'> <'--- a/dir/sm\n'> <'+++ /dev/null\n'> <'@@ -1 +0,0 @@\n'> 
          <'-Subproject commit 0123456789abcdef0123456789abcdef01234567\n'> <'EOF\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'removing a submodule also removes all leading subdirectories'>)} 
      {
        (SQ <'\n'> <'\tgit apply --index create-sm.patch &&\n'> <'\ttest -d dir/sm &&\n'> 
          <'\tgit apply --index remove-sm.patch &&\n'> <'\ttest \\! -d dir\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)