-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test cases for rule file inclusion with ~include
- Loading branch information
1 parent
800fb88
commit 8a3c6cd
Showing
11 changed files
with
119 additions
and
12 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
9 changes: 9 additions & 0 deletions
9
clang/test/dpct/python_migration/case_001/include_rule_file/expected.py
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,9 @@ | ||
import a_repl | ||
import b_repl | ||
|
||
a_repl() | ||
b_repl() | ||
b1_repl() | ||
b2_repl() | ||
b3_repl() | ||
b4_repl() |
13 changes: 13 additions & 0 deletions
13
clang/test/dpct/python_migration/case_001/include_rule_file/include_rule_file.cpp
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,13 @@ | ||
// RUN: rm -rf %T && mkdir -p %T | ||
// RUN: cd %T | ||
// RUN: cp %S/input.py ./ | ||
// RUN: cp %S/expected.py ./ | ||
// RUN: cp -r %S/rules ./ | ||
// RUN: echo "!include %T/rules/b/b4.yaml" >> %T/rules/python_build_script_migration_rule_inc.yaml | ||
|
||
// RUN: dpct -in-root ./ --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/rules/python_build_script_migration_rule_inc.yaml | ||
// RUN: echo "begin" > %T/diff.txt | ||
// RUN: diff --strip-trailing-cr %S/expected.py %T/dpct_output/input.py >> %T/diff.txt | ||
// RUN: echo "end" >> %T/diff.txt | ||
// CHECK: begin | ||
// CHECK-NEXT: end |
9 changes: 9 additions & 0 deletions
9
clang/test/dpct/python_migration/case_001/include_rule_file/input.py
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,9 @@ | ||
import a | ||
import b | ||
|
||
a() | ||
b() | ||
b1() | ||
b2() | ||
b3() | ||
b4() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/a.yaml
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,7 @@ | ||
- Rule: rule_call_a | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_a | ||
In: a() | ||
Out: a_repl() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/b/b.yaml
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,7 @@ | ||
- Rule: rule_call_b | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_b | ||
In: b() | ||
Out: b_repl() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/b/b1.yaml
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,7 @@ | ||
- Rule: rule_call_b1 | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_b1 | ||
In: b1() | ||
Out: b1_repl() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/b/b2.yaml
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,7 @@ | ||
- Rule: rule_call_b2 | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_b2 | ||
In: b2() | ||
Out: b2_repl() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/b/b3.yaml
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,7 @@ | ||
- Rule: rule_call_b3 | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_b3 | ||
In: b3() | ||
Out: b3_repl() |
7 changes: 7 additions & 0 deletions
7
clang/test/dpct/python_migration/case_001/include_rule_file/rules/b/b4.yaml
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,7 @@ | ||
- Rule: rule_call_b4 | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: call_b4 | ||
In: b4() | ||
Out: b4_repl() |
26 changes: 26 additions & 0 deletions
26
...on_migration/case_001/include_rule_file/rules/python_build_script_migration_rule_inc.yaml
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,26 @@ | ||
!include a.yaml | ||
|
||
- Rule: rule_import_a | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: import_a | ||
In: import a | ||
Out: import a_repl | ||
|
||
!include b/b.yaml | ||
|
||
- Rule: rule_import_b | ||
Kind: PythonRule | ||
Priority: Fallback | ||
MatchMode: Partial | ||
PythonSyntax: import_b | ||
In: import b | ||
Out: import b_repl | ||
|
||
!include "b/b1.yaml" | ||
|
||
!include b/b2.yaml | ||
|
||
!include b/b3.yaml | ||
|