add lisp packages
This commit is contained in:
10
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/cat-async
generated
vendored
Executable file
10
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/cat-async
generated
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.readFile(process.argv[2] || "-", "utf8", function(error, contents) {
|
||||
if (error) throw error;
|
||||
rw.writeFile("-", contents, "utf8", function(error) {
|
||||
if (error) throw error;
|
||||
});
|
||||
});
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/cat-sync
generated
vendored
Executable file
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/cat-sync
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFileSync("-", rw.readFileSync(process.argv[2] || "-", "utf8"), "utf8");
|
||||
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-object-async
generated
vendored
Executable file
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-object-async
generated
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFile(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]}, function(error) {
|
||||
if (error) throw error;
|
||||
});
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-object-sync
generated
vendored
Executable file
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-object-sync
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFileSync(process.argv[2] || "-", "gréén\n", {encoding: process.argv[3]});
|
||||
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-string-async
generated
vendored
Executable file
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-string-async
generated
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFile(process.argv[2] || "-", "gréén\n", process.argv[3], function(error) {
|
||||
if (error) throw error;
|
||||
});
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-string-sync
generated
vendored
Executable file
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encode-string-sync
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFileSync(process.argv[2] || "-", "gréén\n", process.argv[3]);
|
||||
42
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encoding-async
generated
vendored
Executable file
42
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encoding-async
generated
vendored
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs"),
|
||||
queue = require("d3-queue").queue,
|
||||
rw = require("../");
|
||||
|
||||
var code = 0;
|
||||
|
||||
queue(1)
|
||||
.defer(testRead, "utf8", "gréén\n")
|
||||
.defer(testRead, {encoding: "utf8"}, "gréén\n")
|
||||
.defer(testRead, "ascii", "grC)C)n\n")
|
||||
.defer(testRead, {encoding: "ascii"}, "grC)C)n\n")
|
||||
.defer(testWrite, "utf8", "gréén\n")
|
||||
.defer(testWrite, {encoding: "utf8"}, "gréén\n")
|
||||
.defer(testWrite, "ascii", "gr<67><72>n\n")
|
||||
.defer(testWrite, {encoding: "ascii"}, "gr<67><72>n\n")
|
||||
.await(done);
|
||||
|
||||
function testRead(options, expected, callback) {
|
||||
rw.readFile("test/utf8.txt", options, function(error, actual) {
|
||||
if (error) return void callback(error);
|
||||
if (actual !== expected) console.warn(actual + " !== " + expected), code = 1;
|
||||
callback(null);
|
||||
});
|
||||
}
|
||||
|
||||
function testWrite(options, expected, callback) {
|
||||
rw.writeFile("test/encoding-async.out", "gréén\n", options, function(error) {
|
||||
if (error) return void callback(error);
|
||||
fs.readFile("test/encoding-async.out", "utf8", function(error, actual) {
|
||||
if (error) return void callback(error);
|
||||
if (actual !== expected) console.warn(actual + " !== " + expected), code = 1;
|
||||
callback(null);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function done(error) {
|
||||
if (error) throw error;
|
||||
process.exit(code);
|
||||
}
|
||||
20
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encoding-sync
generated
vendored
Executable file
20
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/encoding-sync
generated
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var fs = require("fs"),
|
||||
rw = require("../");
|
||||
|
||||
var code = 0,
|
||||
actual,
|
||||
expected;
|
||||
|
||||
if ((actual = rw.readFileSync("test/utf8.txt", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "utf8"})) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
if ((actual = rw.readFileSync("test/utf8.txt", "ascii")) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
if ((actual = rw.readFileSync("test/utf8.txt", {encoding: "ascii"})) !== (expected = "grC)C)n\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
|
||||
rw.writeFileSync("test/encoding-sync.out", "gréén\n", "utf8"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "utf8"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gréén\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
rw.writeFileSync("test/encoding-sync.out", "gréén\n", "ascii"); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr<67><72>n\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
rw.writeFileSync("test/encoding-sync.out", "gréén\n", {encoding: "ascii"}); if ((actual = fs.readFileSync("test/encoding-sync.out", "utf8")) !== (expected = "gr<67><72>n\n")) code = 1, console.warn(actual + " !== " + expected);
|
||||
|
||||
process.exit(code);
|
||||
53
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/run-tests
generated
vendored
Executable file
53
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/run-tests
generated
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE=test/input.txt
|
||||
|
||||
rm -f -- $FILE
|
||||
for i in {1..10000}; do printf '%09X\n' $RANDOM >> $FILE; done
|
||||
|
||||
function test()
|
||||
{
|
||||
if [[ $1 -eq 0 ]]
|
||||
then
|
||||
echo -e "\x1B[1;32m✓ $2\x1B[0m"
|
||||
else
|
||||
echo -e "\x1B[1;31m✗ $2\x1B[0m"
|
||||
fi
|
||||
}
|
||||
|
||||
test/encoding-sync; test $? "encoding-sync applies the specified encodings"
|
||||
test/encoding-async; test $? "encoding-async applies the specified encodings"
|
||||
[ "$(test/wc-async $FILE)" = "100000" ]; test $? "wc-async reads an entire file"
|
||||
[ "$(test/wc-sync $FILE)" = "100000" ]; test $? "wc-sync reads an entire file"
|
||||
[ "$(test/wc-async < $FILE)" = "100000" ]; test $? "wc-async reads an entire file from stdin"
|
||||
[ "$(test/wc-sync < $FILE)" = "100000" ]; test $? "wc-sync reads an entire file from stdin"
|
||||
[ "$(cat $FILE | test/wc-async)" = "100000" ]; test $? "wc-async reads an entire file from a pipe"
|
||||
[ "$(cat $FILE | test/wc-sync)" = "100000" ]; test $? "wc-sync reads an entire file from a pipe"
|
||||
[ "$(test/cat-async $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe"
|
||||
[ "$(test/cat-sync $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe"
|
||||
[ "$(test/cat-async $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-async "
|
||||
[ "$(test/cat-async $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file and writes it to a pipe to wc-sync "
|
||||
[ "$(test/cat-sync $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-async "
|
||||
[ "$(test/cat-sync $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file and writes it to a pipe to wc-sync "
|
||||
[ "$(test/cat-async < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe"
|
||||
[ "$(test/cat-sync < $FILE | wc -c | tr -d ' ')" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe"
|
||||
[ "$(test/cat-async < $FILE | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-async"
|
||||
[ "$(test/cat-async < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from stdin and writes it to a pipe to wc-sync"
|
||||
[ "$(test/cat-sync < $FILE | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-async"
|
||||
[ "$(test/cat-sync < $FILE | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from stdin and writes it to a pipe to wc-sync"
|
||||
[ "$(cat $FILE | test/cat-async | test/wc-async)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-async"
|
||||
[ "$(cat $FILE | test/cat-async | test/wc-sync)" = "100000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to wc-sync"
|
||||
[ "$(cat $FILE | test/cat-sync | test/wc-async)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-async"
|
||||
[ "$(cat $FILE | test/cat-sync | test/wc-sync)" = "100000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to wc-sync"
|
||||
[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-async"
|
||||
[ "$(cat $FILE | test/cat-async | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-async reads an entire file from a pipe and writes it to a pipe to head to wc-sync"
|
||||
[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-async)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-async"
|
||||
[ "$(cat $FILE | test/cat-sync | head -n 100 | test/wc-sync)" = "1000" ]; test $? "cat-sync reads an entire file from a pipe and writes it to a pipe to head to wc-sync"
|
||||
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-async)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-async"
|
||||
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-async | test/wc-sync)" = "1000" ]; test $? "cat-async reads the head of a file from a pipe and writes it to wc-sync"
|
||||
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-async)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-async"
|
||||
[ "$(cat $FILE 2> /dev/null | head -n 100 | test/cat-sync | test/wc-sync)" = "1000" ]; test $? "cat-sync reads the head of a file from a pipe and writes it to wc-sync"
|
||||
[ "$(test/write-async test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-async writes an entire file"
|
||||
[ "$(test/write-sync test/write.out && cat test/write.out)" = "Hello, world!" ]; test $? "write-sync writes an entire file"
|
||||
|
||||
rm -f -- $FILE test/write.out test/encoding-sync.out test/encoding-async.out
|
||||
1
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/utf8.txt
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/utf8.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
gréén
|
||||
8
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/wc-async
generated
vendored
Executable file
8
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/wc-async
generated
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.readFile(process.argv[2] || "-", function(error, contents) {
|
||||
if (error) throw error;
|
||||
console.log(contents.length);
|
||||
});
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/wc-sync
generated
vendored
Executable file
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/wc-sync
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
console.log(rw.readFileSync(process.argv[2] || "-", "utf8").length);
|
||||
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/write-async
generated
vendored
Executable file
7
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/write-async
generated
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFile(process.argv[2] || "-", "Hello, world!", "utf8", function(error) {
|
||||
if (error) throw error;
|
||||
});
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/write-sync
generated
vendored
Executable file
5
lisp/emacs-application-framework/app/mermaid/node_modules/rw/test/write-sync
generated
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var rw = require("../").dash;
|
||||
|
||||
rw.writeFileSync(process.argv[2] || "-", "Hello, world!", "utf8");
|
||||
Reference in New Issue
Block a user