-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from theludovyc/fix#220_do_not_check_indent
fix #220 do not check indent
- Loading branch information
Showing
12 changed files
with
271 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
extends "res://Test/RakugoTest.gd" | ||
|
||
func test_menu(): | ||
var file_path = "res://Test/TestParser/TestMenu/TestMenu.rk" | ||
|
||
var file_base_name = get_file_base_name(file_path) | ||
|
||
watch_rakugo_signals() | ||
|
||
await wait_parse_and_execute_script(file_path) | ||
|
||
await wait_menu(["Loop", "End"]) | ||
|
||
assert_menu_return(0); | ||
|
||
await wait_menu(["Loop", "End"]) | ||
|
||
assert_menu_return(1); | ||
|
||
await wait_execute_script_finished(file_base_name) | ||
|
||
func test_menu_choice_parse_fail(): | ||
var file_path = "res://Test/TestParser/TestMenu/TestMenuChoiceParseFail.rk" | ||
|
||
assert_eq(Rakugo.parse_script(file_path), FAILED) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://dmruluk7xrv2e"] | ||
|
||
[ext_resource type="Script" path="res://Test/TestParser/TestMenu/TestMenu.gd" id="1"] | ||
|
||
[node name="TestMenu" type="Node"] | ||
script = ExtResource("1") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends "res://Test/RakugoTest.gd" | ||
|
||
const file_path = "res://Test/TestParser/TestSay/TestSay.rk" | ||
|
||
var file_base_name = get_file_base_name(file_path) | ||
|
||
func test_say(): | ||
watch_rakugo_signals() | ||
|
||
await wait_parse_and_execute_script(file_path) | ||
|
||
await wait_say({}, "Hello, world !") | ||
|
||
assert_do_step() | ||
|
||
await wait_say({"name": "Sylvie"}, "Hello !") | ||
|
||
assert_do_step() | ||
|
||
await wait_say({}, "My name is Sylvie") | ||
|
||
assert_do_step() | ||
|
||
await wait_say({}, "I am 18") | ||
|
||
assert_do_step() | ||
|
||
await wait_execute_script_finished(file_base_name) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://dt8lnvj37mvw0"] | ||
|
||
[ext_resource type="Script" path="res://Test/TestParser/TestSay/TestSay.gd" id="1"] | ||
|
||
[node name="TestSay" type="Node"] | ||
script = ExtResource("1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,66 @@ | ||
extends "res://Test/RakugoTest.gd" | ||
extends GutTest | ||
|
||
func test_menu(): | ||
var file_path = "res://Test/TestParser/TestMenu/TestMenu.rk" | ||
const Parser = preload("res://addons/Rakugo/lib/systems/Parser.gd") | ||
|
||
var file_base_name = get_file_base_name(file_path) | ||
@onready var parser := Parser.new() | ||
|
||
watch_rakugo_signals() | ||
|
||
await wait_parse_and_execute_script(file_path) | ||
|
||
await wait_menu(["Loop", "End"]) | ||
var test_params = [ | ||
[ | ||
"menu menu:", | ||
"\"loop\" > menu", | ||
"\"end\"" | ||
], | ||
[ | ||
"menu menu:", | ||
" \"loop\" > menu", | ||
" \"end\"" | ||
], | ||
[ | ||
" menu menu: ", | ||
" \"loop\" > menu ", | ||
" \"end\"" | ||
], | ||
[ | ||
"menu menu:", | ||
"\"loop\" > menu", | ||
"\"end\"", | ||
"" | ||
], | ||
[ | ||
"menu menu:", | ||
"\"loop\" > menu", | ||
"\"end\"", | ||
" " | ||
], | ||
[ | ||
"menu menu:", | ||
"\"loop\" > menu", | ||
"\"end\"", | ||
"\"hello, world !\"" | ||
], | ||
[ | ||
"menu menu:", | ||
"\"loop\" > menu", | ||
"\"end\"", | ||
"# comment" | ||
] | ||
] | ||
|
||
assert_menu_return(0); | ||
func test_menu(params=use_parameters(test_params)): | ||
var parsed_script = parser.parse_script(params) | ||
|
||
await wait_menu(["Loop", "End"]) | ||
|
||
assert_menu_return(1); | ||
assert_false(parsed_script.is_empty()) | ||
|
||
var parsed_array = parsed_script["parse_array"] | ||
|
||
assert_false(parsed_array.is_empty()) | ||
|
||
assert_eq(parsed_script["labels"], {"menu":0}) | ||
|
||
var menu_choice_results = parsed_array[0][2] | ||
|
||
await wait_execute_script_finished(file_base_name) | ||
assert_eq(menu_choice_results[0].get_string("text"), "\"loop\"") | ||
|
||
func test_menu_choice_parse_fail(): | ||
var file_path = "res://Test/TestParser/TestMenu/TestMenuChoiceParseFail.rk" | ||
assert_eq(menu_choice_results[0].get_string("label"), "menu") | ||
|
||
assert_eq(Rakugo.parse_script(file_path), FAILED) | ||
assert_eq(menu_choice_results[1].get_string("text"), "\"end\"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://dmruluk7xrv2e"] | ||
[gd_scene load_steps=2 format=3 uid="uid://cryjirfvh5cuq"] | ||
|
||
[ext_resource type="Script" path="res://Test/TestParser/TestMenu/TestMenu.gd" id="1"] | ||
[ext_resource type="Script" path="res://Test/TestParser/TestMenu/TestMenu.gd" id="1_roxlx"] | ||
|
||
[node name="TestMenu" type="Node"] | ||
script = ExtResource("1") | ||
script = ExtResource("1_roxlx") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,73 @@ | ||
extends "res://Test/RakugoTest.gd" | ||
extends GutTest | ||
|
||
const file_path = "res://Test/TestParser/TestSay/TestSay.rk" | ||
const Parser = preload("res://addons/Rakugo/lib/systems/Parser.gd") | ||
|
||
var file_base_name = get_file_base_name(file_path) | ||
@onready var parser := Parser.new() | ||
|
||
func test_say(): | ||
watch_rakugo_signals() | ||
var test_params = [ | ||
["\"Hello, world !\""], | ||
[" \"Hello, world !\""], | ||
[" \"Hello, world !\""], | ||
["\"Hello, world !\" "] | ||
] | ||
|
||
await wait_parse_and_execute_script(file_path) | ||
func test_say(params=use_parameters(test_params)): | ||
var parsed_script = parser.parse_script(params) | ||
|
||
assert_false(parsed_script.is_empty()) | ||
|
||
await wait_say({}, "Hello, world !") | ||
var parsed_array = parsed_script["parse_array"] | ||
|
||
assert_do_step() | ||
assert_false(parsed_array.is_empty()) | ||
|
||
await wait_say({"name": "Sylvie"}, "Hello !") | ||
assert_true(parsed_script.get("labels", [""]).is_empty()) | ||
|
||
assert_do_step() | ||
assert_true(parsed_array[0][0] == "SAY") | ||
|
||
await wait_say({}, "My name is Sylvie") | ||
var result = parsed_array[0][1] | ||
|
||
assert_do_step() | ||
assert_eq(result.get_string("text"), "\"Hello, world !\"") | ||
|
||
func test_say_character(): | ||
var rk_script = [ | ||
"sy \"Hello !\"" | ||
] | ||
|
||
var parsed_script = parser.parse_script(rk_script) | ||
|
||
assert_false(parsed_script.is_empty()) | ||
|
||
var parsed_array = parsed_script["parse_array"] | ||
|
||
assert_false(parsed_array.is_empty()) | ||
|
||
await wait_say({}, "I am 18") | ||
assert_true(parsed_script.get("labels", [""]).is_empty()) | ||
|
||
assert_true(parsed_array[0][0] == "SAY") | ||
|
||
var result = parsed_array[0][1] | ||
|
||
assert_eq(result.get_string("character_tag"), "sy") | ||
|
||
assert_do_step() | ||
assert_eq(result.get_string("text"), "\"Hello !\"") | ||
|
||
await wait_execute_script_finished(file_base_name) | ||
func test_say_variable(): | ||
var rk_script = [ | ||
"\"My name is <sy.name>\"" | ||
] | ||
|
||
var parsed_script = parser.parse_script(rk_script) | ||
|
||
assert_false(parsed_script.is_empty()) | ||
|
||
var parsed_array = parsed_script["parse_array"] | ||
|
||
assert_false(parsed_array.is_empty()) | ||
|
||
assert_true(parsed_script.get("labels", [""]).is_empty()) | ||
|
||
assert_true(parsed_array[0][0] == "SAY") | ||
|
||
var result = parsed_array[0][1] | ||
|
||
assert_eq(result.get_string("text"), "\"My name is <sy.name>\"") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://dt8lnvj37mvw0"] | ||
[gd_scene load_steps=2 format=3 uid="uid://e4471uaguj8k"] | ||
|
||
[ext_resource type="Script" path="res://Test/TestParser/TestSay/TestSay.gd" id="1"] | ||
[ext_resource type="Script" path="res://Test/TestParser/TestSay/TestSay.gd" id="1_ux5ov"] | ||
|
||
[node name="TestSay" type="Node"] | ||
script = ExtResource("1") | ||
script = ExtResource("1_ux5ov") |
Oops, something went wrong.