jssm 5.35.4 → 5.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.codeclimate.yml +22 -22
  2. package/.editorconfig +12 -12
  3. package/.eslintrc +20 -20
  4. package/.nycrc +6 -6
  5. package/.travis.yml +8 -8
  6. package/LICENSE.md +21 -21
  7. package/README.md +997 -993
  8. package/dist/es6/jssm-dot.d.ts +6 -6
  9. package/dist/es6/jssm-dot.js +1 -1
  10. package/dist/es6/jssm.d.ts +100 -100
  11. package/dist/es6/jssm.js +792 -792
  12. package/dist/es6/jssm_types.d.ts +151 -151
  13. package/dist/es6/jssm_types.js +1 -1
  14. package/dist/es6/jssm_util.d.ts +8 -8
  15. package/dist/es6/jssm_util.js +34 -34
  16. package/dist/es6/version.d.ts +2 -2
  17. package/dist/es6/version.js +2 -2
  18. package/dist/jssm.es5.cjs.js +1 -1
  19. package/dist/jssm.es5.iife.js +1 -0
  20. package/jest-spec.config.js +27 -27
  21. package/jest-stoch.config.js +27 -27
  22. package/jssm-dot.d.ts +6 -6
  23. package/jssm.d.ts +100 -100
  24. package/jssm_types.d.ts +151 -151
  25. package/jssm_util.d.ts +8 -8
  26. package/package.json +125 -122
  27. package/rollup.config.iife.js +44 -44
  28. package/rollup.config.js +44 -44
  29. package/src/demo/index.html +38 -38
  30. package/src/demo/style.css +1 -1
  31. package/src/ts/jssm-dot.peg +928 -874
  32. package/src/ts/jssm.ts +1120 -1120
  33. package/src/ts/jssm_types.ts +346 -346
  34. package/src/ts/jssm_util.ts +100 -100
  35. package/src/ts/tests/actions.spec.ts +167 -167
  36. package/src/ts/tests/arrange.spec.ts +72 -72
  37. package/src/ts/tests/arrange.stoch.ts +4 -4
  38. package/src/ts/tests/array_box_if_string.spec.ts +30 -31
  39. package/src/ts/tests/array_transitions.spec.ts +129 -129
  40. package/src/ts/tests/arrow unicode.spec.ts +88 -88
  41. package/src/ts/tests/arrow.spec.ts +124 -124
  42. package/src/ts/tests/colors.spec.ts +58 -58
  43. package/src/ts/tests/comment.spec.ts +134 -134
  44. package/src/ts/tests/compile.spec.ts +79 -79
  45. package/src/ts/tests/constants.spec.ts +98 -98
  46. package/src/ts/tests/cycles.spec.ts +153 -153
  47. package/src/ts/tests/dot_preamble.spec.ts +16 -16
  48. package/src/ts/tests/embedded_sm.spec.ts +36 -36
  49. package/src/ts/tests/flow.spec.ts +22 -22
  50. package/src/ts/tests/forced transitions.spec.ts +26 -26
  51. package/src/ts/tests/general.spec.ts +933 -933
  52. package/src/ts/tests/graph node lists.spec.ts +21 -21
  53. package/src/ts/tests/histo.spec.ts +24 -24
  54. package/src/ts/tests/hooks.spec.ts +28 -0
  55. package/src/ts/tests/language.spec.ts +37 -37
  56. package/src/ts/tests/language_data/belarussian.json +13 -13
  57. package/src/ts/tests/language_data/bengali.json +15 -15
  58. package/src/ts/tests/language_data/emoji.json +21 -21
  59. package/src/ts/tests/language_data/english.json +16 -16
  60. package/src/ts/tests/language_data/french.json +16 -16
  61. package/src/ts/tests/language_data/german.json +16 -16
  62. package/src/ts/tests/language_data/hebrew.json +16 -16
  63. package/src/ts/tests/language_data/portuguese.json +12 -12
  64. package/src/ts/tests/language_data/russian.json +12 -12
  65. package/src/ts/tests/language_data/spanish.json +17 -17
  66. package/src/ts/tests/language_data/ukrainian.json +18 -18
  67. package/src/ts/tests/layout.spec.ts +29 -29
  68. package/src/ts/tests/machine_attributes.spec.ts +398 -398
  69. package/src/ts/tests/machine_name.spec.ts +14 -14
  70. package/src/ts/tests/named lists.spec.ts +24 -19
  71. package/src/ts/tests/nominated states.spec.ts +133 -133
  72. package/src/ts/tests/parse actions.spec.ts +32 -32
  73. package/src/ts/tests/parse.spec.ts +94 -94
  74. package/src/ts/tests/probability.spec.ts +146 -146
  75. package/src/ts/tests/r639.spec.ts +27 -27
  76. package/src/ts/tests/sample_select.spec.ts +173 -173
  77. package/src/ts/tests/seq.spec.ts +14 -16
  78. package/src/ts/tests/seq.stoch.ts +83 -0
  79. package/src/ts/tests/shapes.spec.ts +63 -63
  80. package/src/ts/tests/sm_tag.spec.ts +37 -37
  81. package/src/ts/tests/special characters.spec.ts +39 -39
  82. package/src/ts/tests/state_declaration.spec.ts +214 -200
  83. package/src/ts/tests/state_style.spec.ts +82 -39
  84. package/src/ts/tests/stop light.spec.ts +157 -157
  85. package/src/ts/tests/stripes.spec.ts +52 -52
  86. package/src/ts/tests/theme.spec.ts +45 -45
  87. package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
  88. package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
  89. package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
  90. package/src/ts/version.ts +1 -1
  91. package/tree.txt +1794 -1794
  92. package/tsconfig.json +27 -27
  93. package/version.d.ts +2 -2
@@ -1,124 +1,124 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('arrow_direction', () => {
11
-
12
- const lefts = ['<-', '<=', '<~', '←', '⇐', '↚'],
13
- rights = ['->', '=>', '~>', '→', '⇒', '↛'],
14
- boths = ['<->', '<=>', '<~>',
15
- '<-=>', '<-~>', '<=->', '<=~>', '<~->', '<~=>',
16
- '←⇒', '←↛', '⇐→', '⇐↛', '↚→', '↚⇒',
17
- '←=>', '←~>', '⇐->', '⇐~>', '↚->', '↚=>',
18
- '<-⇒', '<-↛', '<=→', '<=↛', '<~→', '<~⇒' ],
19
-
20
- check = (lab, dir) =>
21
- it(lab, () =>
22
- expect( jssm.arrow_direction(lab) ).toBe(dir) );
23
-
24
- lefts.map( e => check(e, 'left') );
25
- rights.map( e => check(e, 'right') );
26
- boths.map( e => check(e, 'both') );
27
-
28
- test.todo('Bunch of commented out tests here, not clear why');
29
-
30
- /*
31
- test('<-', () => expect(jssm.arrow_direction('<-') ).toBe('left') );
32
- test('<=', () => expect(jssm.arrow_direction('<=') ).toBe('left') );
33
- test('<~', () => expect(jssm.arrow_direction('<~') ).toBe('left') );
34
-
35
- test('->', () => expect(jssm.arrow_direction('->') ).toBe('right') );
36
- test('=>', () => expect(jssm.arrow_direction('=>') ).toBe('right') );
37
- test('~>', () => expect(jssm.arrow_direction('~>') ).toBe('right') );
38
-
39
- test('<->', () => expect(jssm.arrow_direction('<->') ).toBe('both') );
40
- test('<=>', () => expect(jssm.arrow_direction('<=>') ).toBe('both') );
41
- test('<~>', () => expect(jssm.arrow_direction('<~>') ).toBe('both') );
42
-
43
- test('<-=>', () => expect(jssm.arrow_direction('<-=>') ).toBe('both') );
44
- test('<=->', () => expect(jssm.arrow_direction('<=->') ).toBe('both') );
45
- test('<-~>', () => expect(jssm.arrow_direction('<-~>') ).toBe('both') );
46
- test('<~->', () => expect(jssm.arrow_direction('<~->') ).toBe('both') );
47
- test('<=~>', () => expect(jssm.arrow_direction('<=~>') ).toBe('both') );
48
- test('<~=>', () => expect(jssm.arrow_direction('<~=>') ).toBe('both') );
49
- */
50
-
51
- });
52
-
53
-
54
-
55
-
56
-
57
- describe('arrow_left_kind', () => {
58
-
59
- test('->', () => expect(jssm.arrow_left_kind('->') ).toBe('none') );
60
- test('=>', () => expect(jssm.arrow_left_kind('=>') ).toBe('none') );
61
- test('~>', () => expect(jssm.arrow_left_kind('~>') ).toBe('none') );
62
-
63
- test('<-', () => expect(jssm.arrow_left_kind('<-') ).toBe('legal') );
64
- test('<->', () => expect(jssm.arrow_left_kind('<->') ).toBe('legal') );
65
- test('<-=>', () => expect(jssm.arrow_left_kind('<-=>') ).toBe('legal') );
66
- test('<-~>', () => expect(jssm.arrow_left_kind('<-~>') ).toBe('legal') );
67
-
68
- test('<=', () => expect(jssm.arrow_left_kind('<=') ).toBe('main') );
69
- test('<=>', () => expect(jssm.arrow_left_kind('<=>') ).toBe('main') );
70
- test('<=->', () => expect(jssm.arrow_left_kind('<=->') ).toBe('main') );
71
- test('<=~>', () => expect(jssm.arrow_left_kind('<=~>') ).toBe('main') );
72
-
73
- test('<~', () => expect(jssm.arrow_left_kind('<~') ).toBe('forced') );
74
- test('<~>', () => expect(jssm.arrow_left_kind('<~>') ).toBe('forced') );
75
- test('<~->', () => expect(jssm.arrow_left_kind('<~->') ).toBe('forced') );
76
- test('<~=>', () => expect(jssm.arrow_left_kind('<~=>') ).toBe('forced') );
77
-
78
- });
79
-
80
-
81
-
82
-
83
-
84
- describe('arrow_right_kind', () => {
85
-
86
- test('<-', () => expect(jssm.arrow_right_kind('<-') ).toBe('none') );
87
- test('<=', () => expect(jssm.arrow_right_kind('<=') ).toBe('none') );
88
- test('<~', () => expect(jssm.arrow_right_kind('<~') ).toBe('none') );
89
-
90
- test('->', () => expect(jssm.arrow_right_kind('->') ).toBe('legal') );
91
- test('<->', () => expect(jssm.arrow_right_kind('<->') ).toBe('legal') );
92
- test('<=->', () => expect(jssm.arrow_right_kind('<=->') ).toBe('legal') );
93
- test('<~->', () => expect(jssm.arrow_right_kind('<~->') ).toBe('legal') );
94
-
95
- test('=>', () => expect(jssm.arrow_right_kind('=>') ).toBe('main') );
96
- test('<=>', () => expect(jssm.arrow_right_kind('<=>') ).toBe('main') );
97
- test('<-=>', () => expect(jssm.arrow_right_kind('<-=>') ).toBe('main') );
98
- test('<~=>', () => expect(jssm.arrow_right_kind('<~=>') ).toBe('main') );
99
-
100
- test('~>', () => expect(jssm.arrow_right_kind('~>') ).toBe('forced') );
101
- test('<~>', () => expect(jssm.arrow_right_kind('<~>') ).toBe('forced') );
102
- test('<-~>', () => expect(jssm.arrow_right_kind('<-~>') ).toBe('forced') );
103
- test('<=~>', () => expect(jssm.arrow_right_kind('<=~>') ).toBe('forced') );
104
-
105
- });
106
-
107
-
108
-
109
-
110
-
111
- describe('arrow error catchery', () => {
112
-
113
- test('unknown arrow direction throws', () =>
114
- expect( () => jssm.arrow_direction('boop' as any) ).toThrow() );
115
-
116
- test('unknown arrow left kind throws', () =>
117
- expect( () => jssm.arrow_left_kind('boop' as any) ).toThrow() );
118
-
119
- test('unknown arrow right kind throws', () =>
120
- expect( () => jssm.arrow_right_kind('boop' as any) ).toThrow() );
121
-
122
- });
123
-
124
- // stochable
1
+
2
+ /* eslint-disable max-len */
3
+
4
+ import * as jssm from '../jssm';
5
+
6
+
7
+
8
+
9
+
10
+ describe('arrow_direction', () => {
11
+
12
+ const lefts = ['<-', '<=', '<~', '←', '⇐', '↚'],
13
+ rights = ['->', '=>', '~>', '→', '⇒', '↛'],
14
+ boths = ['<->', '<=>', '<~>',
15
+ '<-=>', '<-~>', '<=->', '<=~>', '<~->', '<~=>',
16
+ '←⇒', '←↛', '⇐→', '⇐↛', '↚→', '↚⇒',
17
+ '←=>', '←~>', '⇐->', '⇐~>', '↚->', '↚=>',
18
+ '<-⇒', '<-↛', '<=→', '<=↛', '<~→', '<~⇒' ],
19
+
20
+ check = (lab, dir) =>
21
+ it(lab, () =>
22
+ expect( jssm.arrow_direction(lab) ).toBe(dir) );
23
+
24
+ lefts.map( e => check(e, 'left') );
25
+ rights.map( e => check(e, 'right') );
26
+ boths.map( e => check(e, 'both') );
27
+
28
+ test.todo('Bunch of commented out tests here, not clear why');
29
+
30
+ /*
31
+ test('<-', () => expect(jssm.arrow_direction('<-') ).toBe('left') );
32
+ test('<=', () => expect(jssm.arrow_direction('<=') ).toBe('left') );
33
+ test('<~', () => expect(jssm.arrow_direction('<~') ).toBe('left') );
34
+
35
+ test('->', () => expect(jssm.arrow_direction('->') ).toBe('right') );
36
+ test('=>', () => expect(jssm.arrow_direction('=>') ).toBe('right') );
37
+ test('~>', () => expect(jssm.arrow_direction('~>') ).toBe('right') );
38
+
39
+ test('<->', () => expect(jssm.arrow_direction('<->') ).toBe('both') );
40
+ test('<=>', () => expect(jssm.arrow_direction('<=>') ).toBe('both') );
41
+ test('<~>', () => expect(jssm.arrow_direction('<~>') ).toBe('both') );
42
+
43
+ test('<-=>', () => expect(jssm.arrow_direction('<-=>') ).toBe('both') );
44
+ test('<=->', () => expect(jssm.arrow_direction('<=->') ).toBe('both') );
45
+ test('<-~>', () => expect(jssm.arrow_direction('<-~>') ).toBe('both') );
46
+ test('<~->', () => expect(jssm.arrow_direction('<~->') ).toBe('both') );
47
+ test('<=~>', () => expect(jssm.arrow_direction('<=~>') ).toBe('both') );
48
+ test('<~=>', () => expect(jssm.arrow_direction('<~=>') ).toBe('both') );
49
+ */
50
+
51
+ });
52
+
53
+
54
+
55
+
56
+
57
+ describe('arrow_left_kind', () => {
58
+
59
+ test('->', () => expect(jssm.arrow_left_kind('->') ).toBe('none') );
60
+ test('=>', () => expect(jssm.arrow_left_kind('=>') ).toBe('none') );
61
+ test('~>', () => expect(jssm.arrow_left_kind('~>') ).toBe('none') );
62
+
63
+ test('<-', () => expect(jssm.arrow_left_kind('<-') ).toBe('legal') );
64
+ test('<->', () => expect(jssm.arrow_left_kind('<->') ).toBe('legal') );
65
+ test('<-=>', () => expect(jssm.arrow_left_kind('<-=>') ).toBe('legal') );
66
+ test('<-~>', () => expect(jssm.arrow_left_kind('<-~>') ).toBe('legal') );
67
+
68
+ test('<=', () => expect(jssm.arrow_left_kind('<=') ).toBe('main') );
69
+ test('<=>', () => expect(jssm.arrow_left_kind('<=>') ).toBe('main') );
70
+ test('<=->', () => expect(jssm.arrow_left_kind('<=->') ).toBe('main') );
71
+ test('<=~>', () => expect(jssm.arrow_left_kind('<=~>') ).toBe('main') );
72
+
73
+ test('<~', () => expect(jssm.arrow_left_kind('<~') ).toBe('forced') );
74
+ test('<~>', () => expect(jssm.arrow_left_kind('<~>') ).toBe('forced') );
75
+ test('<~->', () => expect(jssm.arrow_left_kind('<~->') ).toBe('forced') );
76
+ test('<~=>', () => expect(jssm.arrow_left_kind('<~=>') ).toBe('forced') );
77
+
78
+ });
79
+
80
+
81
+
82
+
83
+
84
+ describe('arrow_right_kind', () => {
85
+
86
+ test('<-', () => expect(jssm.arrow_right_kind('<-') ).toBe('none') );
87
+ test('<=', () => expect(jssm.arrow_right_kind('<=') ).toBe('none') );
88
+ test('<~', () => expect(jssm.arrow_right_kind('<~') ).toBe('none') );
89
+
90
+ test('->', () => expect(jssm.arrow_right_kind('->') ).toBe('legal') );
91
+ test('<->', () => expect(jssm.arrow_right_kind('<->') ).toBe('legal') );
92
+ test('<=->', () => expect(jssm.arrow_right_kind('<=->') ).toBe('legal') );
93
+ test('<~->', () => expect(jssm.arrow_right_kind('<~->') ).toBe('legal') );
94
+
95
+ test('=>', () => expect(jssm.arrow_right_kind('=>') ).toBe('main') );
96
+ test('<=>', () => expect(jssm.arrow_right_kind('<=>') ).toBe('main') );
97
+ test('<-=>', () => expect(jssm.arrow_right_kind('<-=>') ).toBe('main') );
98
+ test('<~=>', () => expect(jssm.arrow_right_kind('<~=>') ).toBe('main') );
99
+
100
+ test('~>', () => expect(jssm.arrow_right_kind('~>') ).toBe('forced') );
101
+ test('<~>', () => expect(jssm.arrow_right_kind('<~>') ).toBe('forced') );
102
+ test('<-~>', () => expect(jssm.arrow_right_kind('<-~>') ).toBe('forced') );
103
+ test('<=~>', () => expect(jssm.arrow_right_kind('<=~>') ).toBe('forced') );
104
+
105
+ });
106
+
107
+
108
+
109
+
110
+
111
+ describe('arrow error catchery', () => {
112
+
113
+ test('unknown arrow direction throws', () =>
114
+ expect( () => jssm.arrow_direction('boop' as any) ).toThrow() );
115
+
116
+ test('unknown arrow left kind throws', () =>
117
+ expect( () => jssm.arrow_left_kind('boop' as any) ).toThrow() );
118
+
119
+ test('unknown arrow right kind throws', () =>
120
+ expect( () => jssm.arrow_right_kind('boop' as any) ).toThrow() );
121
+
122
+ });
123
+
124
+ // stochable
@@ -1,58 +1,58 @@
1
-
2
- import { NamedColors } from './constants.spec';
3
- import { sm } from '../jssm';
4
-
5
-
6
-
7
-
8
-
9
- describe('Colors', () => {
10
-
11
- /* eslint-disable max-nested-callbacks */
12
-
13
- const ColorSets = [
14
- { label: "Named colors", dataset: NamedColors },
15
- { label: "Direct colors", dataset: [ '#ABC', '#ABCF', '#AABBCC', '#AABBCCFF' ] }
16
- ];
17
-
18
- ColorSets.map( ({label, dataset}) =>
19
-
20
- dataset.map(col => {
21
-
22
- // edge things
23
- ['edge_color'].map(prop =>
24
- [col, col.toLowerCase()].map(repres =>
25
- test(`${label} - Color "${repres}" parses as ${prop}`, () =>
26
-
27
- expect( () => {
28
- const _foo = sm`machine_name: bob; a-> { ${prop}: ${repres}; } b;`;
29
- }).not.toThrow()
30
-
31
- )
32
- )
33
- );
34
-
35
- // state things
36
- ['color', 'background-color', 'text-color', 'border-color'].map(prop =>
37
- [col, col.toLowerCase()].map(repres =>
38
- test(`${label} - Color "${repres}" parses as ${prop}`, () =>
39
-
40
- expect( () => {
41
- const _foo = sm`machine_name: bob; state a: { ${prop}: ${repres}; }; a -> b;`;
42
- }).not.toThrow()
43
-
44
- )
45
- )
46
- );
47
-
48
- })
49
- );
50
-
51
- /* eslint-enable max-nested-callbacks */
52
-
53
- });
54
-
55
- // TODO FIXME COMEBACK tests for the other color types
56
- // TODO FIXME COMEBACK check that the named colors are coming out sensibly
57
-
58
- // TODO FIXME COMEBACK STOCHABLE assert that #f00, #ff0000, #f00f, #ff0000ff, and red all parse as the same color
1
+
2
+ import { NamedColors } from './constants.spec';
3
+ import { sm } from '../jssm';
4
+
5
+
6
+
7
+
8
+
9
+ describe('Colors', () => {
10
+
11
+ /* eslint-disable max-nested-callbacks */
12
+
13
+ const ColorSets = [
14
+ { label: "Named colors", dataset: NamedColors },
15
+ { label: "Direct colors", dataset: [ '#ABC', '#ABCF', '#AABBCC', '#AABBCCFF' ] }
16
+ ];
17
+
18
+ ColorSets.map( ({label, dataset}) =>
19
+
20
+ dataset.map(col => {
21
+
22
+ // edge things
23
+ ['edge_color'].map(prop =>
24
+ [col, col.toLowerCase()].map(repres =>
25
+ test(`${label} - Color "${repres}" parses as ${prop}`, () =>
26
+
27
+ expect( () => {
28
+ const _foo = sm`machine_name: bob; a-> { ${prop}: ${repres}; } b;`;
29
+ }).not.toThrow()
30
+
31
+ )
32
+ )
33
+ );
34
+
35
+ // state things
36
+ ['color', 'background-color', 'text-color', 'border-color'].map(prop =>
37
+ [col, col.toLowerCase()].map(repres =>
38
+ test(`${label} - Color "${repres}" parses as ${prop}`, () =>
39
+
40
+ expect( () => {
41
+ const _foo = sm`machine_name: bob; state a: { ${prop}: ${repres}; }; a -> b;`;
42
+ }).not.toThrow()
43
+
44
+ )
45
+ )
46
+ );
47
+
48
+ })
49
+ );
50
+
51
+ /* eslint-enable max-nested-callbacks */
52
+
53
+ });
54
+
55
+ // TODO FIXME COMEBACK tests for the other color types
56
+ // TODO FIXME COMEBACK check that the named colors are coming out sensibly
57
+
58
+ // TODO FIXME COMEBACK STOCHABLE assert that #f00, #ff0000, #f00f, #ff0000ff, and red all parse as the same color
@@ -1,134 +1,134 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('block strategies', () => {
11
-
12
- const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
13
-
14
- is_AB = str =>
15
- test(str, () => expect(jssm.parse(str)).toEqual(AtoB) ),
16
-
17
- ABCD = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}},
18
- {"key": "transition", "from": "c", "se": {"kind": "->","to": "d"}}],
19
-
20
- is_ABCD = str =>
21
- test(str, () => expect(jssm.parse(str)).toEqual(ABCD) );
22
-
23
- describe('empty block comments in left middle', () => {
24
- is_AB('a/**/->b;');
25
- is_AB('a /**/->b;');
26
- is_AB('a/**/ ->b;');
27
- is_AB('a /**/ ->b;');
28
- is_AB('a\n/**/->b;');
29
- is_AB('a/**/\n->b;');
30
- is_AB('a\n/**/\n->b;');
31
- });
32
-
33
- describe('empty block comments in right middle', () => {
34
- is_AB('a->/**/b;');
35
- is_AB('a-> /**/b;');
36
- is_AB('a->/**/ b;');
37
- is_AB('a-> /**/ b;');
38
- is_AB('a->\n/**/b;');
39
- is_AB('a->/**/\nb;');
40
- is_AB('a->\n/**/\nb;');
41
- });
42
-
43
- describe('non-empty block comments in left middle', () => {
44
- is_AB('a/* hello */->b;');
45
- is_AB('a /* hello */->b;');
46
- is_AB('a/* hello */ ->b;');
47
- is_AB('a /* hello */ ->b;');
48
- is_AB('a\n/* hello */ ->b;');
49
- is_AB('a/* hello */\n->b;');
50
- is_AB('a\n/* hello */\n->b;');
51
- });
52
-
53
- describe('empty block comments before', () => {
54
- is_AB('/**/a->b;');
55
- is_AB('/**/ a->b;');
56
- });
57
-
58
- describe('empty block comments inbetween', () => {
59
- is_ABCD('a->b;/**/c->d;');
60
- is_ABCD('a->b; /**/c->d;');
61
- is_ABCD('a->b;/**/ c->d;');
62
- is_ABCD('a->b; /**/ c->d;');
63
- });
64
-
65
- describe('empty block comments after / at end', () => {
66
- is_AB('a->b;/**/');
67
- is_AB('a->b; /**/');
68
- });
69
-
70
- describe('block commented code', () => {
71
- is_AB('a->b;/* c->d; */');
72
- is_AB('a->b;\n/*c -> d;*/\n');
73
- is_ABCD('a->b;/* e->f; */c->d;');
74
- is_ABCD('a->b;\n/*e -> f;*/\nc->d;');
75
- is_ABCD('a->b;\n/*e -> f;*/\nc->d;\n');
76
- });
77
-
78
- });
79
-
80
-
81
-
82
-
83
-
84
- describe('line strategies', () => {
85
-
86
- const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
87
-
88
- is_AB = str =>
89
- test(str, () => expect(jssm.parse(str)).toEqual(AtoB) ),
90
-
91
- ABCD = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}},
92
- {"key": "transition", "from": "c", "se": {"kind": "->","to": "d"}}],
93
-
94
- is_ABCD = str =>
95
- test(str, () => expect(jssm.parse(str)).toEqual(ABCD) );
96
-
97
- describe('empty line comments at end', () => {
98
- is_AB('a->b;//');
99
- is_AB('a->b; //');
100
- is_AB('a->b;//\n');
101
- is_AB('a->b; //\n');
102
- });
103
-
104
- describe('non-empty line comments at end', () => {
105
- is_AB('a->b;// hello');
106
- is_AB('a->b; // hello');
107
- is_AB('a->b;// hello\n');
108
- is_AB('a->b; // hello\n');
109
- });
110
-
111
- describe('empty line comments at beginning', () => {
112
- is_AB('//\na->b;');
113
- });
114
-
115
- describe('non-empty line comments at beginning', () => {
116
- is_AB('// hello\na->b;');
117
- });
118
-
119
- describe('empty line comments inbetween', () => {
120
- is_ABCD('a->b;//\nc->d;');
121
- });
122
-
123
- describe('non-empty line comments inbetween', () => {
124
- is_ABCD('a->b;// hello\nc->d;');
125
- });
126
-
127
- describe('line commented code', () => {
128
- is_AB( 'a->b;// c->d;');
129
- is_AB( 'a->b;\n//c -> d;\n');
130
- is_ABCD('a->b;// e->f;\nc->d;');
131
- is_ABCD('a->b;\n//e -> f;\nc->d;');
132
- });
133
-
134
- });
1
+
2
+ /* eslint-disable max-len */
3
+
4
+ import * as jssm from '../jssm';
5
+
6
+
7
+
8
+
9
+
10
+ describe('block strategies', () => {
11
+
12
+ const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
13
+
14
+ is_AB = str =>
15
+ test(str, () => expect(jssm.parse(str)).toEqual(AtoB) ),
16
+
17
+ ABCD = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}},
18
+ {"key": "transition", "from": "c", "se": {"kind": "->","to": "d"}}],
19
+
20
+ is_ABCD = str =>
21
+ test(str, () => expect(jssm.parse(str)).toEqual(ABCD) );
22
+
23
+ describe('empty block comments in left middle', () => {
24
+ is_AB('a/**/->b;');
25
+ is_AB('a /**/->b;');
26
+ is_AB('a/**/ ->b;');
27
+ is_AB('a /**/ ->b;');
28
+ is_AB('a\n/**/->b;');
29
+ is_AB('a/**/\n->b;');
30
+ is_AB('a\n/**/\n->b;');
31
+ });
32
+
33
+ describe('empty block comments in right middle', () => {
34
+ is_AB('a->/**/b;');
35
+ is_AB('a-> /**/b;');
36
+ is_AB('a->/**/ b;');
37
+ is_AB('a-> /**/ b;');
38
+ is_AB('a->\n/**/b;');
39
+ is_AB('a->/**/\nb;');
40
+ is_AB('a->\n/**/\nb;');
41
+ });
42
+
43
+ describe('non-empty block comments in left middle', () => {
44
+ is_AB('a/* hello */->b;');
45
+ is_AB('a /* hello */->b;');
46
+ is_AB('a/* hello */ ->b;');
47
+ is_AB('a /* hello */ ->b;');
48
+ is_AB('a\n/* hello */ ->b;');
49
+ is_AB('a/* hello */\n->b;');
50
+ is_AB('a\n/* hello */\n->b;');
51
+ });
52
+
53
+ describe('empty block comments before', () => {
54
+ is_AB('/**/a->b;');
55
+ is_AB('/**/ a->b;');
56
+ });
57
+
58
+ describe('empty block comments inbetween', () => {
59
+ is_ABCD('a->b;/**/c->d;');
60
+ is_ABCD('a->b; /**/c->d;');
61
+ is_ABCD('a->b;/**/ c->d;');
62
+ is_ABCD('a->b; /**/ c->d;');
63
+ });
64
+
65
+ describe('empty block comments after / at end', () => {
66
+ is_AB('a->b;/**/');
67
+ is_AB('a->b; /**/');
68
+ });
69
+
70
+ describe('block commented code', () => {
71
+ is_AB('a->b;/* c->d; */');
72
+ is_AB('a->b;\n/*c -> d;*/\n');
73
+ is_ABCD('a->b;/* e->f; */c->d;');
74
+ is_ABCD('a->b;\n/*e -> f;*/\nc->d;');
75
+ is_ABCD('a->b;\n/*e -> f;*/\nc->d;\n');
76
+ });
77
+
78
+ });
79
+
80
+
81
+
82
+
83
+
84
+ describe('line strategies', () => {
85
+
86
+ const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
87
+
88
+ is_AB = str =>
89
+ test(str, () => expect(jssm.parse(str)).toEqual(AtoB) ),
90
+
91
+ ABCD = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}},
92
+ {"key": "transition", "from": "c", "se": {"kind": "->","to": "d"}}],
93
+
94
+ is_ABCD = str =>
95
+ test(str, () => expect(jssm.parse(str)).toEqual(ABCD) );
96
+
97
+ describe('empty line comments at end', () => {
98
+ is_AB('a->b;//');
99
+ is_AB('a->b; //');
100
+ is_AB('a->b;//\n');
101
+ is_AB('a->b; //\n');
102
+ });
103
+
104
+ describe('non-empty line comments at end', () => {
105
+ is_AB('a->b;// hello');
106
+ is_AB('a->b; // hello');
107
+ is_AB('a->b;// hello\n');
108
+ is_AB('a->b; // hello\n');
109
+ });
110
+
111
+ describe('empty line comments at beginning', () => {
112
+ is_AB('//\na->b;');
113
+ });
114
+
115
+ describe('non-empty line comments at beginning', () => {
116
+ is_AB('// hello\na->b;');
117
+ });
118
+
119
+ describe('empty line comments inbetween', () => {
120
+ is_ABCD('a->b;//\nc->d;');
121
+ });
122
+
123
+ describe('non-empty line comments inbetween', () => {
124
+ is_ABCD('a->b;// hello\nc->d;');
125
+ });
126
+
127
+ describe('line commented code', () => {
128
+ is_AB( 'a->b;// c->d;');
129
+ is_AB( 'a->b;\n//c -> d;\n');
130
+ is_ABCD('a->b;// e->f;\nc->d;');
131
+ is_ABCD('a->b;\n//e -> f;\nc->d;');
132
+ });
133
+
134
+ });