forked from scratchfoundation/scratch-gui
-
Notifications
You must be signed in to change notification settings - Fork 20
/
ruby.test.js
46 lines (40 loc) · 1.16 KB
/
ruby.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import RubyToBlocksConverter from '../../../../src/lib/ruby-to-blocks-converter';
import {
convertAndExpectRubyBlockError
} from '../../../helpers/expect-to-equal-blocks';
describe('RubyToBlocksConverter/Ruby', () => {
let converter;
let target;
beforeEach(() => {
converter = new RubyToBlocksConverter(null);
target = null;
});
test('ruby_range', () => {
const code = '1..10';
convertAndExpectRubyBlockError(converter, target, code);
});
test('ruby_exclude_range', () => {
const code = '1...10';
convertAndExpectRubyBlockError(converter, target, code);
});
test('ruby_statement(wait)', () => {
[
'wait',
'wait()',
'wait( )',
'wait(\n)'
].forEach(s => {
convertAndExpectRubyBlockError(converter, target, s);
});
});
test('ruby_statement_with_block', () => {
const code = `
method_call(1) do |arg1, arg2|
move(arg1)
move(arg2)
move(10)
end
`;
convertAndExpectRubyBlockError(converter, target, code);
});
});