Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test js cli #1

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
jobs:

build-c:
if: 0
strategy:
matrix:
BUILD_TYPE: [Debug, Release]
Expand Down Expand Up @@ -46,6 +47,14 @@ jobs:
- name: Test
run: npm test

- name: Install
run: |
npm install --global

- name: Test CLI
run: |
sh -c '[ "$(npm exec -- uklatn -t DSTU_9112_B мрії мої)" = "mriji moji" ]'


build-py:
runs-on: ubuntu-latest
Expand All @@ -59,6 +68,7 @@ jobs:


build-swift:
if: 0
strategy:
matrix:
BUILD_TYPE: [debug, release]
Expand Down
2 changes: 1 addition & 1 deletion js/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
import path from 'node:path';
import * as uklatn from 'uklatn';
import * as uklatn from './uklatn.js';


const _Usage = '[-h] [-t TABLE] [-c] [-l] text [text ...]\n';
Expand Down
3 changes: 3 additions & 0 deletions js/uklatn.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,6 @@ export function decode(text, table) {
if (tr === undefined) { throw new Error("unknown table " + JSON.stringify(table)); }
return tr.transform(text);
}


export default { encode, decode };
3 changes: 3 additions & 0 deletions tools/gen/gen_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ def _emit_tr(cname, rules, file):
if (tr === undefined) {{ throw new Error("unknown table " + JSON.stringify(table)); }}
return tr.transform(text);
}}


export default {{ encode, decode }};
'''
text = template.format(**context)
return text
Expand Down