47 lines
1.4 KiB
Text
47 lines
1.4 KiB
Text
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
|
|
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
|
|
pkgname=node-print
|
|
pkgver=5
|
|
pkgrel=0
|
|
pkgdesc="another terrible javascript engine wrapper"
|
|
url="https://git.ddd.rip/ptrcnull/ptrcports"
|
|
arch="noarch"
|
|
license="BSD-2-Clause"
|
|
depends="nodejs-current"
|
|
source="np index.js"
|
|
builddir="$srcdir"
|
|
|
|
_assert() {
|
|
[ "$1" == "$2" ] || { echo "'$1' != '$2'"; return 1; }
|
|
}
|
|
|
|
check() {
|
|
local out
|
|
out="$(echo test | node -r . -p "stdin().substring(2).replace('t', 'rc').replace('s', 'pt')")"
|
|
_assert "$out" "ptrc"
|
|
|
|
out="$(echo '{"test":"property"}' | node -r . -p "stdin().test")"
|
|
_assert "$out" "property"
|
|
|
|
out="$(echo '["item"]' | node -r . -p "stdin()[0]")"
|
|
_assert "$out" "item"
|
|
|
|
out="$(echo crtp | node -r . -p "stdin().lines()[0].reverse()")"
|
|
_assert "$out" "ptrc"
|
|
|
|
out="$(node -r . -p "exec('echo', ['1']).stdout.toString()")"
|
|
_assert "$out" "1"
|
|
|
|
out="$(node -r . -p "exec('echo', ['[]']).stdout.length")"
|
|
_assert "$out" "0"
|
|
}
|
|
|
|
package() {
|
|
install -Dm755 np "$pkgdir"/usr/bin/np
|
|
install -Dm644 index.js "$pkgdir"/usr/lib/node/ptrc/index.js
|
|
}
|
|
|
|
sha512sums="
|
|
b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np
|
|
afcc775f7d76b05bf72eef59a47b02d9a2021b09015b37502eaa457d9b38f3259a99c2ebf8ed8b5a1e36b27dd13ab447f2e673467d5717b60452d8c585aba995 index.js
|
|
"
|