|
66 | 66 | (let ((dart-command (lsp-dart-test-command-fixture)))
|
67 | 67 | (lsp-dart-test-from-dart-project
|
68 | 68 | (mock (executable-find "dart") => dart-command)
|
| 69 | + (mock (lsp-dart-flutter-snap-install-p) => nil) |
69 | 70 | (should (equal (lsp-dart-get-sdk-dir) (concat (-> dart-command
|
70 | 71 | f-parent
|
71 | 72 | f-parent)
|
|
81 | 82 | (mock (file-exists-p dart-sdk) => t)
|
82 | 83 | (should (equal (lsp-dart-get-sdk-dir) dart-sdk)))))
|
83 | 84 |
|
| 85 | +(ert-deftest lsp-dart-get-sdk-dir--snap-install-test () |
| 86 | + (lsp-dart-test-from-dart-project |
| 87 | + (mock (lsp-dart-flutter-snap-install-p) => t) |
| 88 | + (should (equal (lsp-dart-get-sdk-dir) "~/snap/flutter/common/flutter/bin/cache/dart-sdk")))) |
| 89 | + |
84 | 90 | (ert-deftest lsp-dart-get-sdk-dir--project-without-dart-on-path-test ()
|
85 | 91 | (lsp-dart-test-from-dart-project
|
86 | 92 | (mock (executable-find "dart") => nil)
|
| 93 | + (mock (lsp-dart-flutter-snap-install-p) => nil) |
87 | 94 | (should (equal (lsp-dart-get-sdk-dir) nil))))
|
88 | 95 |
|
89 | 96 | (ert-deftest lsp-dart-get-flutter-sdk-dir--custom-dir-test ()
|
90 | 97 | (let ((lsp-dart-flutter-sdk-dir "/some/sdk"))
|
91 | 98 | (should (equal (lsp-dart-get-flutter-sdk-dir) "/some/sdk"))))
|
92 | 99 |
|
| 100 | +(ert-deftest lsp-dart-get-flutter-sdk-dir--snap-install-test () |
| 101 | + (lsp-dart-test-from-flutter-project |
| 102 | + (let ((system-type "gnu/linux")) |
| 103 | + (mock (executable-find lsp-dart-flutter-executable) => "/snap/bin/flutter") |
| 104 | + (mock (file-exists-p "~/snap/flutter/common/flutter/bin/flutter") => t) |
| 105 | + (should (equal (lsp-dart-get-flutter-sdk-dir) "~/snap/flutter/common/flutter"))))) |
| 106 | + |
93 | 107 | (ert-deftest lsp-dart-get-flutter-sdk-dir--with-flutter-on-path-test ()
|
94 | 108 | (let ((flutter-command (lsp-dart-test-flutter-command-fixture)))
|
95 | 109 | (lsp-dart-test-from-flutter-project
|
|
0 commit comments