File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { files , fromFile } from "../lib/input" ;
2
+ import { formatMessage } from "../lib/tools" ;
3
+ import { validate } from "../lib/validate" ;
4
+ import { Resource } from "../resolver/resource" ;
5
+
6
+ const specs = process . argv [ 2 ] ;
7
+
8
+ if ( ! specs ) {
9
+ console . error ( "Usage: node resolver.js SPEC" ) ;
10
+ process . exit ( 1 ) ;
11
+ }
12
+
13
+ for ( let file of files ( specs , ".md" ) ) {
14
+ let source = fromFile ( file ) ;
15
+ validate ( format , file , source ) ;
16
+ }
17
+
18
+ function format ( input : string ) {
19
+ let resource = new Resource ( input ) ;
20
+ let result = formatMessage ( resource , new Map ( ) , "test" ) ;
21
+ return JSON . stringify ( result , null , 4 ) ;
22
+ }
Original file line number Diff line number Diff line change 19
19
"test:ebnf" : " node -r esm ./syntax/test/ebnf.js ./syntax/parser/grammar.js ./syntax/spec/fluent.ebnf" ,
20
20
"test:fixtures" : " node -r esm ./syntax/test/parser.js ./syntax/test/fixtures" ,
21
21
"test:unit" : " node -r esm ./syntax/test/literals.js" ,
22
- "test" : " npm run --silent test:fixtures && npm run --silent test:unit" ,
22
+ "test:format" : " node ./build/format/test/resolver.js ./format/spec/" ,
23
+ "test" : " npm run --silent test:fixtures && npm run --silent test:unit && npm run --silent test:format" ,
23
24
"watch" : " tsc --watch"
24
25
},
25
26
"homepage" : " https://projectfluent.org" ,
You can’t perform that action at this time.
0 commit comments