emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/typescript-mode c5e7788ce9 044/222: Merge pull request #28


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode c5e7788ce9 044/222: Merge pull request #28 from ananthakumaran/testing
Date: Sun, 6 Feb 2022 16:59:10 -0500 (EST)

branch: elpa/typescript-mode
commit c5e7788ce9baa8d8a53fcc6d1eca5f120d74962d
Merge: 3b0ace2a71 bf9a4155cc
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>

    Merge pull request #28 from ananthakumaran/testing
    
    Add CI and test-setup
---
 .gitignore                                   | 86 ++++++++++++++++++++++++++
 .travis.yml                                  | 17 +++++
 Makefile                                     |  9 +++
 README.md                                    |  2 +
 test-files/indentation-reference-document.ts | 92 ++++++++++++++++++++++++++++
 typescript-mode-tests.el                     | 34 ++++++++++
 6 files changed, 240 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..d54dbd59d7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,86 @@
+
+# Created by https://www.gitignore.io/api/emacs,windows,linux
+
+### Emacs ###
+# -*- mode: gitignore; -*-
+*~
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+
+# cask packages
+.cask/
+dist/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+# directory configuration
+.dir-locals.el
+
+### Linux ###
+
+# temporary files which can be created if a process still has a handle open of 
a deleted file
+.fuse_hidden*
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+# .nfs files are created when an open file is removed but is still being 
accessed
+.nfs*
+
+### Windows ###
+# Windows thumbnail cache files
+Thumbs.db
+ehthumbs.db
+ehthumbs_vista.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# End of https://www.gitignore.io/api/emacs,windows,linux
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000000..7409597f0f
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: generic
+sudo: false
+before_install:
+  - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh 
&& source ./x.sh
+  - evm install $EVM_EMACS --use --skip
+  - cask
+
+env:
+  - EVM_EMACS=emacs-24.3-travis
+  - EVM_EMACS=emacs-24.4-travis
+  - EVM_EMACS=emacs-24.5-travis
+  - EVM_EMACS=emacs-25.1-travis
+  - EVM_EMACS=emacs-git-snapshot-travis
+ 
+script:
+  - emacs --version
+  - make test
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..abaa9bf6c9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+EMACS=$(shell which emacs) -Q -batch -L .
+
+cask:
+       cask build
+
+test: cask
+       + $(EMACS) -l typescript-mode-tests.el -f ert-run-tests-batch-and-exit
+
+# end
diff --git a/README.md b/README.md
index f55f8a4bf8..4d504a6564 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
 # typescript.el
 
+[![Build 
Status](https://api.travis-ci.org/ananthakumaran/typescript.el.svg?branch=master)](https://travis-ci.org/ananthakumaran/typescript.el)
+
 `typescript.el` is major-mode for editing 
[Typescript](http://www.typescriptlang.org/)-files in [GNU 
Emacs](https://www.gnu.org/software/emacs/).
 
 `typescript.el` is a self-contained, lightweight and minimalist major-mode
diff --git a/test-files/indentation-reference-document.ts 
b/test-files/indentation-reference-document.ts
new file mode 100644
index 0000000000..a6df0e6dc0
--- /dev/null
+++ b/test-files/indentation-reference-document.ts
@@ -0,0 +1,92 @@
+/// <reference types="node" />
+/// <reference path="shared.ts" />
+/// <reference path="session.ts" />
+// used in fs.writeSync
+/* tslint:disable:no-null-keyword */
+
+/*
+ * this file is a butchered copy of TypeScript's tsserver.ts file
+ * made to contain the most important syntactical elements
+ * of TypeScript to verify indentation-code.
+ *
+ * It will not build, and that's NOT a problem!
+ */
+
+// namespaces indent.
+namespace ts.server {
+
+    const net: {
+        connect(options: { port: number }, onConnect?: () => void): NodeSocket
+    } = require("net");
+
+    // functions indent.
+    function getGlobalTypingsCacheLocation() {
+        // We know switch/case is indented incorrectly.
+        // TODO: FIX!
+
+        // switch (process.platform) {
+        //     case "win32": {
+        //         const basePath = process.env.LOCALAPPDATA ||
+        //             process.env.APPDATA;
+        //         return combinePaths(normalizeSlashes(basePath), 
"Microsoft/TypeScript");
+        //     }
+        //     case "darwin":
+        //     case "linux":
+        //     case "android": {
+        //         const cacheLocation = 
getNonWindowsCacheLocation(process.platform === "darwin");
+        //         return combinePaths(cacheLocation, "typescript");
+        //     }
+        //     default:
+        //         Debug.fail(`unsupported platform '${process.platform}'`);
+        //         return;
+        // }
+    }
+
+    // interfaces and classes indent.
+    interface NodeChildProcess {
+        send(message: any, sendHandle?: any): void;
+        on(message: "message" | "exit", f: (m: any) => void): void;
+        kill(): void;
+        pid: number;
+    }
+
+    class Logger implements ts.server.Logger {
+        private firstInGroup = true;
+
+        // parameter-lists are currently not indented like tsserver wants it 
to...
+        // constructor(private readonly logFilename: string,
+        //     private readonly traceToConsole: boolean,
+        //     private readonly level: LogLevel) {
+        // }
+
+        // function-typed class-members indent.
+        constructor(private readonly logFilename: string) {
+            console.log("yes");
+        }
+
+        static padStringRight(str: string, padding: string) {
+            return (str + padding).slice(0, padding.length);
+        }
+
+        close() {
+            if (this.fd >= 0) {
+                fs.close(this.fd);
+            }
+        }
+    }
+
+    // object initialization/parameter-lists indent.
+    const ioSession = new IOSession(
+        sys,
+        cancellationToken,
+        eventPort,
+        /*canUseEvents*/ eventPort === undefined,
+        useSingleInferredProject,
+        disableAutomaticTypingAcquisition,
+        getGlobalTypingsCacheLocation(),
+        telemetryEnabled,
+        logger);
+    process.on("uncaughtException", function (err: Error) {
+        ioSession.logError(err, "unknown");
+    });
+}
diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
new file mode 100644
index 0000000000..fb40785094
--- /dev/null
+++ b/typescript-mode-tests.el
@@ -0,0 +1,34 @@
+
+;;; typescript-mode-tests --- This file contains automated tests for 
typescript-mode.el
+
+;;; Commentary:
+;; Run tests using (ert-run-tests-interactively t).
+
+;;; Code:
+
+(require 'ert)
+(require 'typescript-mode)
+
+(defun typescript-test-get-doc ()
+  (buffer-substring-no-properties (point-min) (point-max)))
+
+(defun typescript-test-indent-all ()
+  (delete-trailing-whitespace)
+  (indent-region (point-min) (point-max) nil)
+  (untabify (point-min) (point-max)))
+
+(ert-deftest indentation-reference-document-is-reflowed-correctly ()
+  (let* ((buffer (find-file "test-files/indentation-reference-document.ts")))
+    ;; double ensure mode is active
+    (typescript-mode)
+
+    (let ((test-reference (typescript-test-get-doc)))
+      (typescript-test-indent-all)
+      (should (string-equal test-reference
+                            (typescript-test-get-doc))))
+
+    (kill-buffer buffer)))
+
+(provide 'typescript-mode-tests)
+
+;;; typescript-mode-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]