jssm 5.45.2 → 5.48.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 (82) hide show
  1. package/dist/es6/jssm.d.ts +3 -1
  2. package/dist/es6/jssm.js +10 -0
  3. package/dist/es6/jssm_types.d.ts +6 -5
  4. package/dist/es6/version.js +1 -1
  5. package/dist/jssm.es5.cjs.js +1 -1
  6. package/jssm.d.ts +3 -1
  7. package/jssm_types.d.ts +6 -5
  8. package/package.json +1 -1
  9. package/.codeclimate.yml +0 -22
  10. package/.editorconfig +0 -12
  11. package/.eslintrc +0 -20
  12. package/.nycrc +0 -6
  13. package/.travis.yml +0 -9
  14. package/dist/jssm.es5.iife.js +0 -1
  15. package/jest-spec.config.js +0 -27
  16. package/jest-stoch.config.js +0 -27
  17. package/rollup.config.iife.js +0 -44
  18. package/rollup.config.js +0 -44
  19. package/src/demo/index.html +0 -38
  20. package/src/demo/style.css +0 -2
  21. package/src/ts/jssm-dot.peg +0 -928
  22. package/src/ts/jssm.ts +0 -1243
  23. package/src/ts/jssm_types.ts +0 -385
  24. package/src/ts/jssm_util.ts +0 -117
  25. package/src/ts/tests/actions.spec.ts +0 -167
  26. package/src/ts/tests/arrange.spec.ts +0 -72
  27. package/src/ts/tests/arrange.stoch.ts +0 -4
  28. package/src/ts/tests/array_box_if_string.spec.ts +0 -30
  29. package/src/ts/tests/array_transitions.spec.ts +0 -129
  30. package/src/ts/tests/arrow unicode.spec.ts +0 -88
  31. package/src/ts/tests/arrow.spec.ts +0 -124
  32. package/src/ts/tests/colors.spec.ts +0 -58
  33. package/src/ts/tests/comment.spec.ts +0 -134
  34. package/src/ts/tests/compile.spec.ts +0 -79
  35. package/src/ts/tests/constants.spec.ts +0 -98
  36. package/src/ts/tests/cycles.spec.ts +0 -153
  37. package/src/ts/tests/dot_preamble.spec.ts +0 -16
  38. package/src/ts/tests/embedded_sm.spec.ts +0 -36
  39. package/src/ts/tests/flow.spec.ts +0 -22
  40. package/src/ts/tests/forced transitions.spec.ts +0 -26
  41. package/src/ts/tests/general.spec.ts +0 -933
  42. package/src/ts/tests/graph node lists.spec.ts +0 -21
  43. package/src/ts/tests/histo.spec.ts +0 -24
  44. package/src/ts/tests/hooks.spec.ts +0 -209
  45. package/src/ts/tests/language.spec.ts +0 -37
  46. package/src/ts/tests/language_data/belarussian.json +0 -14
  47. package/src/ts/tests/language_data/bengali.json +0 -16
  48. package/src/ts/tests/language_data/emoji.json +0 -22
  49. package/src/ts/tests/language_data/english.json +0 -17
  50. package/src/ts/tests/language_data/french.json +0 -17
  51. package/src/ts/tests/language_data/german.json +0 -17
  52. package/src/ts/tests/language_data/hebrew.json +0 -16
  53. package/src/ts/tests/language_data/portuguese.json +0 -13
  54. package/src/ts/tests/language_data/russian.json +0 -13
  55. package/src/ts/tests/language_data/spanish.json +0 -17
  56. package/src/ts/tests/language_data/ukrainian.json +0 -19
  57. package/src/ts/tests/layout.spec.ts +0 -29
  58. package/src/ts/tests/machine_attributes.spec.ts +0 -398
  59. package/src/ts/tests/machine_name.spec.ts +0 -14
  60. package/src/ts/tests/named lists.spec.ts +0 -24
  61. package/src/ts/tests/nominated states.spec.ts +0 -133
  62. package/src/ts/tests/parse actions.spec.ts +0 -32
  63. package/src/ts/tests/parse.spec.ts +0 -94
  64. package/src/ts/tests/probability.spec.ts +0 -146
  65. package/src/ts/tests/r639.spec.ts +0 -27
  66. package/src/ts/tests/sample_select.spec.ts +0 -173
  67. package/src/ts/tests/seq.spec.ts +0 -14
  68. package/src/ts/tests/seq.stoch.ts +0 -83
  69. package/src/ts/tests/shapes.spec.ts +0 -63
  70. package/src/ts/tests/sm_tag.spec.ts +0 -37
  71. package/src/ts/tests/special characters.spec.ts +0 -39
  72. package/src/ts/tests/state_declaration.spec.ts +0 -214
  73. package/src/ts/tests/state_style.spec.ts +0 -82
  74. package/src/ts/tests/stop light.spec.ts +0 -157
  75. package/src/ts/tests/stripes.spec.ts +0 -52
  76. package/src/ts/tests/theme.spec.ts +0 -45
  77. package/src/ts/tests/weighted_histo_key.spec.ts +0 -22
  78. package/src/ts/tests/weighted_rand_select.spec.ts +0 -27
  79. package/src/ts/tests/weighted_sample_select.spec.ts +0 -24
  80. package/src/ts/version.ts +0 -3
  81. package/tree.txt +0 -1794
  82. package/tsconfig.json +0 -27
@@ -1,72 +0,0 @@
1
-
2
- import { sm } from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- describe('Arrange', () => {
9
-
10
-
11
-
12
- test('Single arrange', () => {
13
-
14
- expect( () => { const _foo = sm`arrange [a b]; a -> b;`; })
15
- .not.toThrow();
16
-
17
- expect(
18
- sm`arrange [a b]; a -> b;`._arrange_declaration
19
- ).toEqual(
20
- [['a','b']]
21
- );
22
-
23
- });
24
-
25
-
26
-
27
- test('Multiple arrange', () => {
28
-
29
- expect( () => { const _foo = sm`arrange [a b]; a -> b; c -> d; arrange [c d];`; })
30
- .not.toThrow();
31
-
32
- expect(
33
- sm`arrange [a b]; a -> b; c -> d; arrange [c d];`._arrange_declaration
34
- ).toEqual(
35
- [['a','b'],['c','d']]
36
- );
37
-
38
- });
39
-
40
-
41
-
42
- test('start', () => {
43
-
44
- expect( () => { const _foo = sm`arrange-start [a c]; a -> b -> c -> d;`; })
45
- .not.toThrow();
46
-
47
- expect(
48
- sm`arrange-start [a c]; a -> b -> c -> d;`._arrange_start_declaration
49
- ).toEqual(
50
- [['a','c']]
51
- );
52
-
53
- });
54
-
55
-
56
-
57
- test('end', () => {
58
-
59
- expect( () => { const _foo = sm`arrange-end [a c]; a -> b -> c -> d;`; })
60
- .not.toThrow();
61
-
62
- expect(
63
- sm`arrange-end [b d]; a -> b -> c -> d;`._arrange_end_declaration
64
- ).toEqual(
65
- [['b','d']]
66
- );
67
-
68
- });
69
-
70
-
71
-
72
- });
@@ -1,4 +0,0 @@
1
-
2
- // import { sm } from '../jssm';
3
-
4
- test('TODO placeholder', () => { expect(1).toBe(1); });
@@ -1,30 +0,0 @@
1
-
2
- import { array_box_if_string } from '../jssm_util';
3
-
4
-
5
-
6
-
7
-
8
- const testData = [
9
- [ 0, 0 ],
10
- [ true, true ],
11
- [ "a", ["a"] ],
12
- [ ["a"], ["a"] ],
13
- [ [], [] ],
14
- [ undefined, undefined ]
15
- ];
16
-
17
-
18
-
19
-
20
-
21
- describe('array_box_if_string/1', () => {
22
-
23
- testData.map( ([src, dest]) =>
24
- test(`${JSON.stringify(src)} generates ${JSON.stringify(dest)}`, () =>
25
- expect( array_box_if_string(src) )
26
- .toEqual(dest) ) );
27
-
28
- });
29
-
30
- // stochable
@@ -1,129 +0,0 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('Array basics', () => {
11
-
12
-
13
-
14
- describe('array of one', () => {
15
-
16
- const aLeft = [
17
- {main_path: false,forced_only: false,"from":"a","to":"d","kind":"legal"}
18
- ];
19
-
20
- test('[a]->d;', () => expect( jssm.compile(jssm.parse('[a]->d;')).transitions ).toEqual(aLeft) );
21
-
22
- });
23
-
24
-
25
-
26
- describe('array of one', () => {
27
-
28
- const aLeft = [
29
- {main_path: false,forced_only: false,"from":"a","to":"d","kind":"legal"}
30
- ];
31
-
32
- test('[a]->d;', () => expect( jssm.compile(jssm.parse('[a]->d;')).transitions ).toEqual(aLeft) );
33
-
34
- });
35
-
36
-
37
-
38
- });
39
-
40
-
41
-
42
-
43
-
44
- describe('Array sides', () => {
45
-
46
-
47
-
48
- describe('array on left', () => {
49
-
50
- const aLeft = [
51
- {main_path: false,forced_only: false,"from":"a","to":"d","kind":"legal"},
52
- {main_path: false,forced_only: false,"from":"b","to":"d","kind":"legal"},
53
- {main_path: false,forced_only: false,"from":"c","to":"d","kind":"legal"}
54
- ];
55
-
56
- test('[a b c]->d;', () => expect( jssm.compile(jssm.parse('[a b c]->d;')).transitions ).toEqual(aLeft) );
57
-
58
- });
59
-
60
-
61
-
62
- describe('array on right', () => {
63
-
64
- const aRight = [
65
- {main_path: false,forced_only: false,"from":"a","to":"b","kind":"legal"},
66
- {main_path: false,forced_only: false,"from":"a","to":"c","kind":"legal"},
67
- {main_path: false,forced_only: false,"from":"a","to":"d","kind":"legal"}
68
- ];
69
-
70
- test('a->[b c d];', () => expect( jssm.compile(jssm.parse('a->[b c d];')).transitions ).toEqual(aRight) );
71
-
72
- });
73
-
74
-
75
-
76
- describe('array on both sides', () => {
77
-
78
- const aBoth = [
79
- {main_path: false,forced_only: false,"from":"a","to":"x","kind":"legal"},
80
- {main_path: false,forced_only: false,"from":"a","to":"y","kind":"legal"},
81
- {main_path: false,forced_only: false,"from":"a","to":"z","kind":"legal"},
82
- {main_path: false,forced_only: false,"from":"b","to":"x","kind":"legal"},
83
- {main_path: false,forced_only: false,"from":"b","to":"y","kind":"legal"},
84
- {main_path: false,forced_only: false,"from":"b","to":"z","kind":"legal"},
85
- {main_path: false,forced_only: false,"from":"c","to":"x","kind":"legal"},
86
- {main_path: false,forced_only: false,"from":"c","to":"y","kind":"legal"},
87
- {main_path: false,forced_only: false,"from":"c","to":"z","kind":"legal"}
88
- ];
89
-
90
- test('[a b c]->[x y z];', () => expect( jssm.compile(jssm.parse('[a b c]->[x y z];')).transitions ).toEqual(aBoth) );
91
-
92
- });
93
-
94
-
95
-
96
- describe('array in middle', () => {
97
-
98
- const aBoth = [
99
- {main_path: false,forced_only: false,"from":"a","to":"x","kind":"legal"},
100
- {main_path: false,forced_only: false,"from":"a","to":"y","kind":"legal"},
101
- {main_path: false,forced_only: false,"from":"a","to":"z","kind":"legal"},
102
- {main_path: false,forced_only: false,"from":"x","to":"b","kind":"legal"},
103
- {main_path: false,forced_only: false,"from":"y","to":"b","kind":"legal"},
104
- {main_path: false,forced_only: false,"from":"z","to":"b","kind":"legal"}
105
- ];
106
-
107
- test('a->[x y z]->b;', () => expect( jssm.compile(jssm.parse('a->[x y z]->b;')).transitions ).toEqual(aBoth) );
108
-
109
- });
110
-
111
-
112
-
113
- });
114
-
115
-
116
-
117
-
118
-
119
- describe('array of zero must throw', () => {
120
-
121
- const aLeft = [];
122
-
123
- test('On left []->d;', () => expect( () => jssm.compile( jssm.parse('[]->d;') ).transitions ).toThrow() );
124
- test('On right d->[];', () => expect( () => jssm.compile( jssm.parse('d->[];') ).transitions ).toThrow() );
125
- test('On both []->[];', () => expect( () => jssm.compile( jssm.parse('[]->[];') ).transitions ).toThrow() );
126
- test('In middle d->[]->e;', () => expect( () => jssm.compile( jssm.parse('d->[]->e;') ).transitions ).toThrow() );
127
- test('In loop d->[]->d;', () => expect( () => jssm.compile( jssm.parse('d->[]->d;') ).transitions ).toThrow() );
128
-
129
- });
@@ -1,88 +0,0 @@
1
- /* eslint-disable max-len */
2
-
3
- import * as jssm from '../jssm';
4
-
5
-
6
-
7
-
8
-
9
- test.todo('Re-enable the unicode arrow blocks once we work that into the machine');
10
-
11
- // describe('arrow_direction', () => {
12
-
13
- // test('verify ←', () => expect(jssm.arrow_direction('←')).toBe('left'));
14
- // test('verify ⇐', () => expect(jssm.arrow_direction('⇐')).toBe('left'));
15
- // test('verify ↚', () => expect(jssm.arrow_direction('↚')).toBe('left'));
16
-
17
- // test('verify →', () => expect(jssm.arrow_direction('→')).toBe('right'));
18
- // test('verify ⇒', () => expect(jssm.arrow_direction('⇒')).toBe('right'));
19
- // test('verify ↛', () => expect(jssm.arrow_direction('↛')).toBe('right'));
20
-
21
- // test('verify ↔', () => expect(jssm.arrow_direction('↔')).toBe('both'));
22
- // test('verify ⇔', () => expect(jssm.arrow_direction('⇔')).toBe('both'));
23
- // test('verify ↮', () => expect(jssm.arrow_direction('↮')).toBe('both'));
24
-
25
- // test('verify ←⇒', () => expect(jssm.arrow_direction('←⇒')).toBe('both'));
26
- // test('verify ⇐→', () => expect(jssm.arrow_direction('⇐→')).toBe('both'));
27
- // test('verify ←↛', () => expect(jssm.arrow_direction('←↛')).toBe('both'));
28
- // test('verify ↚→', () => expect(jssm.arrow_direction('↚→')).toBe('both'));
29
- // test('verify ⇐↛', () => expect(jssm.arrow_direction('⇐↛')).toBe('both'));
30
- // test('verify ↚⇒', () => expect(jssm.arrow_direction('↚⇒')).toBe('both'));
31
-
32
- // });
33
-
34
-
35
-
36
-
37
-
38
- // describe('arrow_left_kind', () => {
39
-
40
- // test('verify →', () => expect(jssm.arrow_left_kind('→')).toBe('none'));
41
- // test('verify ⇒', () => expect(jssm.arrow_left_kind('⇒')).toBe('none'));
42
- // test('verify ↛', () => expect(jssm.arrow_left_kind('↛')).toBe('none'));
43
-
44
- // test('verify ←', () => expect(jssm.arrow_left_kind('←')).toBe('legal'));
45
- // test('verify ↔', () => expect(jssm.arrow_left_kind('↔')).toBe('legal'));
46
- // test('verify ←⇒', () => expect(jssm.arrow_left_kind('←⇒')).toBe('legal'));
47
- // test('verify ←↛', () => expect(jssm.arrow_left_kind('←↛')).toBe('legal'));
48
-
49
- // test('verify ⇐', () => expect(jssm.arrow_left_kind('⇐')).toBe('main'));
50
- // test('verify ⇔', () => expect(jssm.arrow_left_kind('⇔')).toBe('main'));
51
- // test('verify ⇐→', () => expect(jssm.arrow_left_kind('⇐→')).toBe('main'));
52
- // test('verify ⇐↛', () => expect(jssm.arrow_left_kind('⇐↛')).toBe('main'));
53
-
54
- // test('verify ↚', () => expect(jssm.arrow_left_kind('↚')).toBe('forced'));
55
- // test('verify ↮', () => expect(jssm.arrow_left_kind('↮')).toBe('forced'));
56
- // test('verify ↚→', () => expect(jssm.arrow_left_kind('↚→')).toBe('forced'));
57
- // test('verify ↚⇒', () => expect(jssm.arrow_left_kind('↚⇒')).toBe('forced'));
58
-
59
- // });
60
-
61
-
62
-
63
-
64
-
65
- // describe('arrow_right_kind', () => {
66
-
67
- // test('verify ←', () => expect(jssm.arrow_right_kind('←')).toBe('none'));
68
- // test('verify ⇐', () => expect(jssm.arrow_right_kind('⇐')).toBe('none'));
69
- // test('verify ↚', () => expect(jssm.arrow_right_kind('↚')).toBe('none'));
70
-
71
- // test('verify →', () => expect(jssm.arrow_right_kind('→')).toBe('legal'));
72
- // test('verify ↔', () => expect(jssm.arrow_right_kind('↔')).toBe('legal'));
73
- // test('verify ⇐→', () => expect(jssm.arrow_right_kind('⇐→')).toBe('legal'));
74
- // test('verify ↚→', () => expect(jssm.arrow_right_kind('↚→')).toBe('legal'));
75
-
76
- // test('verify ⇒', () => expect(jssm.arrow_right_kind('⇒')).toBe('main'));
77
- // test('verify ⇔', () => expect(jssm.arrow_right_kind('⇔')).toBe('main'));
78
- // test('verify ←⇒', () => expect(jssm.arrow_right_kind('←⇒')).toBe('main'));
79
- // test('verify ↚⇒', () => expect(jssm.arrow_right_kind('↚⇒')).toBe('main'));
80
-
81
- // test('verify ↛', () => expect(jssm.arrow_right_kind('↛')).toBe('forced'));
82
- // test('verify ↮', () => expect(jssm.arrow_right_kind('↮')).toBe('forced'));
83
- // test('verify ←↛', () => expect(jssm.arrow_right_kind('←↛')).toBe('forced'));
84
- // test('verify ⇐↛', () => expect(jssm.arrow_right_kind('⇐↛')).toBe('forced'));
85
-
86
- // });
87
-
88
- // // stochable
@@ -1,124 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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
- });