Skip to content

Commit

Permalink
Added a basic output.txt for end-to-end Enums test (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Goldberg authored Nov 2, 2018
1 parent 576fa9b commit 1d1b3a9
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 68 deletions.
11 changes: 0 additions & 11 deletions test/end-to-end/Enums/enums.cs

This file was deleted.

10 changes: 0 additions & 10 deletions test/end-to-end/Enums/enums.gls

This file was deleted.

10 changes: 0 additions & 10 deletions test/end-to-end/Enums/enums.java

This file was deleted.

10 changes: 0 additions & 10 deletions test/end-to-end/Enums/enums.js

This file was deleted.

8 changes: 0 additions & 8 deletions test/end-to-end/Enums/enums.py

This file was deleted.

9 changes: 0 additions & 9 deletions test/end-to-end/Enums/enums.rb

This file was deleted.

10 changes: 0 additions & 10 deletions test/end-to-end/Enums/enums.ts

This file was deleted.

28 changes: 28 additions & 0 deletions test/end-to-end/Enums/index.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
using System;

namespace Enums
{
enum Direction
{
Unknown = 0,
Horizontal = 1,
Vertical = 2
}

class Index
{
public static void Main()
{
Console.WriteLine(string.Format("Unknown by lookup is {0}", Direction.Unknown));
Console.WriteLine(string.Format("Horizontal by lookup is {0}", Direction.Horizontal));
Console.WriteLine(string.Format("Vertical by lookup is {0}", Direction.Vertical));

Direction direction;
Direction unknown = Direction.Unknown;

Console.WriteLine(string.Format("unknown variable is {0}", unknown));
}
}
}
//
6 changes: 6 additions & 0 deletions test/end-to-end/Enums/index.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
</Project>
22 changes: 22 additions & 0 deletions test/end-to-end/Enums/index.gls
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-
file start : Enums Index
enum start : Direction
enum member : Unknown 0 ,
enum member : Horizontal 1 ,
enum member : Vertical 2
enum end

main context start
main start
print : { string format : ("Unknown by lookup is {0}") { enum : Direction Unknown } int }
print : { string format : ("Horizontal by lookup is {0}") { enum : Direction Horizontal } int }
print : { string format : ("Vertical by lookup is {0}") { enum : Direction Vertical } int }

variable : direction Direction
variable : unknown Direction { enum : Direction Unknown }

print : { string format : ("unknown variable is {0}") unknown int }
main end
main context end
file end
-
22 changes: 22 additions & 0 deletions test/end-to-end/Enums/index.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
package enums;

enum Direction {
Unknown(0),
Horizontal(1),
Vertical(2)
}

class Index {
public static void main(String[] args) {
System.out.println(String.format("Unknown by lookup is %0$d", Direction.Unknown));
System.out.println(String.format("Horizontal by lookup is %0$d", Direction.Horizontal));
System.out.println(String.format("Vertical by lookup is %0$d", Direction.Vertical));

Direction direction;
Direction unknown = Direction.Unknown;

System.out.println(String.format("unknown variable is %0$d", unknown));
}
}
//
16 changes: 16 additions & 0 deletions test/end-to-end/Enums/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
const Direction = {
Unknown: 0,
Horizontal: 1,
Vertical: 2
};

console.log(`Unknown by lookup is ${Direction.Unknown}`);
console.log(`Horizontal by lookup is ${Direction.Horizontal}`);
console.log(`Vertical by lookup is ${Direction.Vertical}`);

let direction;
let unknown = Direction.Unknown;

console.log(`unknown variable is ${unknown}`);
//
15 changes: 15 additions & 0 deletions test/end-to-end/Enums/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
class Direction(Enum):
Unknown = 0
Horizontal = 1
Vertical = 2

if __name__ == "__main__":
print("Unknown by lookup is {0}".format(Direction.Unknown))
print("Horizontal by lookup is {0}".format(Direction.Horizontal))
print("Vertical by lookup is {0}".format(Direction.Vertical))

unknown = Direction.Unknown

print("unknown variable is {0}".format(unknown))
#
15 changes: 15 additions & 0 deletions test/end-to-end/Enums/index.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
class Direction
Unknown = 0
Horizontal = 1
Vertical = 2
end

puts "Unknown by lookup is %d" % [Direction::Unknown]
puts "Horizontal by lookup is %d" % [Direction::Horizontal]
puts "Vertical by lookup is %d" % [Direction::Vertical]

unknown = Direction::Unknown

puts "unknown variable is %d" % [unknown]
#
16 changes: 16 additions & 0 deletions test/end-to-end/Enums/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
enum Direction {
Unknown = 0,
Horizontal = 1,
Vertical = 2
}

console.log(`Unknown by lookup is ${Direction.Unknown}`);
console.log(`Horizontal by lookup is ${Direction.Horizontal}`);
console.log(`Vertical by lookup is ${Direction.Vertical}`);

let direction: Direction;
let unknown: Direction = Direction.Unknown;

console.log(`unknown variable is ${unknown}`);
//

0 comments on commit 1d1b3a9

Please sign in to comment.