Skip to content

Commit fe212ff

Browse files
committed
todo
1 parent f2fecd6 commit fe212ff

File tree

12 files changed

+124
-2
lines changed

12 files changed

+124
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
# Go workspace file
2121
go.work
2222

23-
bin
23+
bin
24+
25+
*.class

PROMPT.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,47 @@ The format should be like this (STICK TO THIS!):
4242
- If error is on multiple files, rely on the stack trace if present.
4343
- Code modification is not necessary.
4444
- You may give more than one bug fix suggestion.
45+
46+
47+
===
48+
49+
TEST FILE PROMPT
50+
51+
Pretend that you are unit test case generator for a debugging assistant for novice programmers and your responses must be backed by the Kolb Experiential Learning Theory.
52+
53+
The structure of the input will look like this:
54+
55+
template: {{language}}.{{error_code}}
56+
error type: {{runtime or compile-time}}
57+
description: {{error description}}
58+
{{if example_error_message}}
59+
example error message:
60+
```
61+
{{example_error_message}}
62+
```
63+
{{endif}}
64+
65+
The target audience of this would be students from the Philippines who don't know how to read the error messages or does not know how to do debugging. They also have a short attention span so longer explanations do not work for them. This is learning by doing so make them understand and gradually do not rely on this tool.
66+
67+
The expected output should be a unit test case which consists of a sample test program and test template. The format should be like this (STICK TO THIS!):
68+
69+
Source code:
70+
```
71+
// {{name}}.{{language extension}}
72+
{{program code}}
73+
```
74+
75+
Test template:
76+
```
77+
template: "{{language}}.{{error_code}}"
78+
---
79+
{{if example_error_message}}
80+
{{example_error_message}}
81+
{{else}}
82+
{{generated compiler/runtime error message similar to language's compiler}}
83+
{{endif}}
84+
```
85+
86+
Notes:
87+
- Filename / class name should be short
88+
- No need to add comments in the source code. Make it simple to reproduce as possible

error_templates/java/public_class_filename_mismatch_error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ var PublicClassFilenameMismatchError = lib.ErrorTemplate{
1919
)
2020
},
2121
OnGenBugFixFn: func(cd *lib.ContextData, gen *lib.BugFixGenerator) {
22-
// TODO:
22+
2323
},
2424
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// BracketMismatch.java
2+
public class BracketMismatch {
3+
public static void main(String[] args) {
4+
int x = 10;
5+
if (x > 5) {
6+
System.out.println("x is greater than 5.");
7+
} // Missing closing bracket for if statement
8+
}
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
template: "Java.BracketMismatchError"
2+
---
3+
BracketMismatch.java:7: error: '}' expected
4+
System.out.println("x is greater than 5.");
5+
^
6+
1 error
7+
===
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class CannotBeApplied {
2+
public static void main(String[] args) {
3+
int result = addValues("5", 10); // Attempting to add a string and an integer
4+
}
5+
6+
public static int addValues(int a, int b) {
7+
return a + b;
8+
}
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
template: "Java.CannotBeAppliedError"
2+
---
3+
CannotBeApplied.java:3: error: method addValues in class CannotBeApplied cannot be applied to given types;
4+
int result = addValues("5", 10); // Attempting to add a string and an integer
5+
^
6+
required: int,int
7+
found: String,int
8+
reason: argument mismatch; String cannot be converted to int
9+
1 error
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class Test {
2+
public static void main(String[] args) {
3+
int[] numbers = {1, 2, 3, 4, 5};
4+
displayArray(numbers);
5+
}
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
template: "Java.MethodNotFoundError"
2+
---
3+
Test.java:4: error: cannot find symbol
4+
displayArray(numbers);
5+
^
6+
symbol: method displayArray(int[])
7+
location: class Test
8+
1 error
9+
===
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// MyClass.java
2+
public class MyClass {
3+
public static void main(String[] args) {
4+
// Attempting to create an instance of a non-existing class
5+
NonExistingClass obj = new NonExistingClass();
6+
}
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
template: "Java.NoClassDefError"
2+
---
3+
MyClass.java:5: error: cannot find symbol
4+
NonExistingClass obj = new NonExistingClass();
5+
^
6+
symbol: class NonExistingClass
7+
location: class MyClass
8+
MyClass.java:5: error: cannot find symbol
9+
NonExistingClass obj = new NonExistingClass();
10+
^
11+
symbol: class NonExistingClass
12+
location: class MyClass
13+
2 errors
14+
===

tests/java/Test.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class Test {
2+
public static void main(String[] args) {
3+
int[] numbers = {1, 2, 3, 4, 5};
4+
displayArray(numbers);
5+
}
6+
}

0 commit comments

Comments
 (0)