2022-08-27 11:01:43 +00:00
|
|
|
# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
|
|
|
|
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
|
|
|
|
pkgname=node-print
|
2023-04-28 03:11:30 +00:00
|
|
|
pkgver=11
|
2022-08-27 11:01:43 +00:00
|
|
|
pkgrel=0
|
|
|
|
pkgdesc="another terrible javascript engine wrapper"
|
|
|
|
url="https://git.ddd.rip/ptrcnull/ptrcports"
|
2023-05-03 02:05:27 +00:00
|
|
|
arch="noarch !armhf !armv7" # hangs on tests
|
2022-08-27 11:01:43 +00:00
|
|
|
license="BSD-2-Clause"
|
|
|
|
depends="nodejs-current"
|
|
|
|
source="np index.js"
|
|
|
|
builddir="$srcdir"
|
|
|
|
|
2022-08-27 12:08:44 +00:00
|
|
|
_assert() {
|
|
|
|
[ "$1" == "$2" ] || { echo "'$1' != '$2'"; return 1; }
|
|
|
|
}
|
|
|
|
|
2022-08-27 11:01:43 +00:00
|
|
|
check() {
|
2022-08-27 11:51:10 +00:00
|
|
|
local out
|
2022-08-27 11:01:43 +00:00
|
|
|
out="$(echo test | node -r . -p "stdin().substring(2).replace('t', 'rc').replace('s', 'pt')")"
|
2022-08-27 12:08:44 +00:00
|
|
|
_assert "$out" "ptrc"
|
2022-10-11 11:16:01 +00:00
|
|
|
|
2022-08-27 11:51:10 +00:00
|
|
|
out="$(echo '{"test":"property"}' | node -r . -p "stdin().test")"
|
2022-08-27 12:08:44 +00:00
|
|
|
_assert "$out" "property"
|
2022-08-27 11:51:10 +00:00
|
|
|
|
|
|
|
out="$(echo '["item"]' | node -r . -p "stdin()[0]")"
|
2022-08-27 12:08:44 +00:00
|
|
|
_assert "$out" "item"
|
|
|
|
|
|
|
|
out="$(echo crtp | node -r . -p "stdin().lines()[0].reverse()")"
|
|
|
|
_assert "$out" "ptrc"
|
2022-10-11 11:16:01 +00:00
|
|
|
|
|
|
|
out="$(node -r . -p "exec('echo', ['1']).stdout.toString()")"
|
|
|
|
_assert "$out" "1"
|
|
|
|
|
|
|
|
out="$(node -r . -p "exec('echo', ['[]']).stdout.length")"
|
|
|
|
_assert "$out" "0"
|
2022-08-27 11:01:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
|
|
|
install -Dm755 np "$pkgdir"/usr/bin/np
|
|
|
|
install -Dm644 index.js "$pkgdir"/usr/lib/node/ptrc/index.js
|
|
|
|
}
|
|
|
|
|
|
|
|
sha512sums="
|
|
|
|
b3dfdeb49637be33d2e2718c5abcf35a87dd55023918c99341273c3b38bd6685189d1f786451a742c47c5f3bc3b58555decb58e2a3a018c9b9ee92043f8fac03 np
|
2023-04-28 03:11:30 +00:00
|
|
|
3355f0f044726a75111f7a2788c5eb6150e44c7f9b4789973a6dda9ac980bc6133677067007e9c40f4c576ad2f8365922f98eda422e690a12775025eb788b584 index.js
|
2022-08-27 11:01:43 +00:00
|
|
|
"
|