[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4fb2abe 29/60: Update simple-csv-parser
From: |
Junpeng Qiu |
Subject: |
[elpa] master 4fb2abe 29/60: Update simple-csv-parser |
Date: |
Tue, 25 Oct 2016 17:45:14 +0000 (UTC) |
branch: master
commit 4fb2abe96221ab4688bdf85681de5c7260a2709f
Author: Junpeng Qiu <address@hidden>
Commit: Junpeng Qiu <address@hidden>
Update simple-csv-parser
---
examples/simple-csv-parser-tests.el | 39 +++++++++++++++++++++++++++++++++++
examples/simple-csv-parser.el | 8 +++----
2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/examples/simple-csv-parser-tests.el
b/examples/simple-csv-parser-tests.el
new file mode 100644
index 0000000..1cb1e9d
--- /dev/null
+++ b/examples/simple-csv-parser-tests.el
@@ -0,0 +1,39 @@
+;;; simple-csv-parser-tests.el --- Tests for simple csv parser -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2016 Junpeng Qiu
+
+;; Author: Junpeng Qiu <address@hidden>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'simple-csv-parser)
+
+(ert-deftest test-simple-csv ()
+ (should
+ (equal
+ (s-parse-csv "a1s,b,d,e,f\na,,c,d,")
+ '(("a1s" "b" "d" "e" "f")
+ ("a" "" "c" "d" "")))))
+
+
+(provide 'simple-csv-parser-tests)
+;;; simple-csv-parser-tests.el ends here
diff --git a/examples/simple-csv-parser.el b/examples/simple-csv-parser.el
index 705717c..c2c55e8 100644
--- a/examples/simple-csv-parser.el
+++ b/examples/simple-csv-parser.el
@@ -24,6 +24,8 @@
;;; Code:
+(require 'parsec)
+
(defun s-csv-file ()
(parsec-many (s-csv-line)))
@@ -45,12 +47,8 @@
(parsec-or (parsec-and (parsec-ch ?,) (s-csv-cells)) nil))
(defun s-parse-csv (input)
- (with-temp-buffer
- (insert input)
- (goto-char (point-min))
+ (parsec-with-input input
(s-csv-file)))
-(s-parse-csv "a1s,b,d,e,f")
-
(provide 'simple-csv-parser)
;;; simple-csv-parser.el ends here
- [elpa] master bf49fb6 38/60: Upate README, (continued)
- [elpa] master bf49fb6 38/60: Upate README, Junpeng Qiu, 2016/10/25
- [elpa] master 966ca9e 43/60: Add comments to parsec.el, Junpeng Qiu, 2016/10/25
- [elpa] master c61a38c 22/60: Add convenient newline methods, Junpeng Qiu, 2016/10/25
- [elpa] master 0c3408a 01/60: Init commit, Junpeng Qiu, 2016/10/25
- [elpa] master 1929932 02/60: Split into two files, Junpeng Qiu, 2016/10/25
- [elpa] master fd77961 25/60: Add a few simple API, Junpeng Qiu, 2016/10/25
- [elpa] master 12d2ad6 24/60: Bug fixes, Junpeng Qiu, 2016/10/25
- [elpa] master adf4706 20/60: Add many-till, notFollowedBy and fix others, Junpeng Qiu, 2016/10/25
- [elpa] master 32809ad 30/60: Add parsec-error-new-2, Junpeng Qiu, 2016/10/25
- [elpa] master 3503e4a 13/60: Rename for easier understanding, Junpeng Qiu, 2016/10/25
- [elpa] master 4fb2abe 29/60: Update simple-csv-parser,
Junpeng Qiu <=
- [elpa] master fa2e6f1 27/60: Add gitignore, Junpeng Qiu, 2016/10/25
- [elpa] master a06220c 42/60: Update README, Junpeng Qiu, 2016/10/25
- [elpa] master f7e8629 26/60: Add tests, Junpeng Qiu, 2016/10/25
- [elpa] master bc11325 50/60: Add file examples/.nosearch, Junpeng Qiu, 2016/10/25
- [elpa] master 1da4344 32/60: Update url-str-parser, Junpeng Qiu, 2016/10/25
- [elpa] master 89dd2ac 54/60: Fix some wording in README, Junpeng Qiu, 2016/10/25
- [elpa] master 55515ca 48/60: Add missing dependencies, Junpeng Qiu, 2016/10/25
- [elpa] master 2e9f962 59/60: Add new package parsec to externals-list, Junpeng Qiu, 2016/10/25
- [elpa] master 3827d26 36/60: Add docs for user-interface functions & combinators, Junpeng Qiu, 2016/10/25
- [elpa] master 8c108be 56/60: Add parsec-peek and parsec-peek-p, Junpeng Qiu, 2016/10/25