@@ -280,6 +280,39 @@ myReverse xs = revAcc [] xs where
280
280
(kill-buffer buffer)
281
281
(idris-quit)))))
282
282
283
+ (ert-deftest idris-test-idris-start-project ()
284
+ " Test generating valid .ipkg file."
285
+ (let ((mock-project-name " TestProject" )
286
+ (mock-package-file-name " test-project.ipkg" )
287
+ (mock-source-directory " src" )
288
+ (mock-first-module " TestModule" )
289
+ (mock-directory-name " test-start-project" ))
290
+ (unwind-protect
291
+ (cl-letf (((symbol-function 'read-string )
292
+ (lambda (prompt &rest _ )
293
+ (cond ((string-prefix-p " Project name:" prompt)
294
+ mock-project-name)
295
+ ((string-prefix-p " Package file name" prompt)
296
+ mock-package-file-name)
297
+ ((string-prefix-p " Source directory" prompt)
298
+ mock-source-directory)
299
+ ((string-prefix-p " First module name" prompt)
300
+ mock-first-module))))
301
+ ((symbol-function 'read-directory-name )
302
+ (lambda (&rest _ ) mock-directory-name)))
303
+ (idris-start-project)
304
+ (with-current-buffer mock-package-file-name
305
+ (goto-char (point-min ))
306
+ (should (search-forward " package test-project" ))
307
+ (should (search-forward " opts = \"\" " ))
308
+ (should (search-forward " sourcedir = \" src\" " ))
309
+ (should (search-forward " modules = TestModule" ))
310
+ (kill-buffer )))
311
+ (if (get-buffer (concat mock-first-module " .idr" ))
312
+ (kill-buffer (concat mock-first-module " .idr" )))
313
+ (delete-directory mock-directory-name t )
314
+ (idris-quit))))
315
+
283
316
; ; Tests by Yasuhiko Watanabe
284
317
; ; https://github.com/idris-hackers/idris-mode/pull/537/files
285
318
(idris-ert-command-action " test-data/CaseSplit.idr" idris-case-split idris-test-eq-buffer)
0 commit comments