summaryrefslogtreecommitdiff
path: root/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go')
-rw-r--r--vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go85
1 files changed, 0 insertions, 85 deletions
diff --git a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go b/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go
deleted file mode 100644
index aa3a8565f..000000000
--- a/vendor/github.com/varlink/go/cmd/varlink-go-interface-generator/generator_test.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package main
-
-import (
- "strings"
- "testing"
-)
-
-func expect(t *testing.T, expected string, returned string) {
- if strings.Compare(returned, expected) != 0 {
- t.Fatalf("Expected(%d): `%s`\nGot(%d): `%s`\n",
- len(expected), expected,
- len(returned), returned)
- }
-}
-
-func TestIDLParser(t *testing.T) {
- pkgname, b, err := generateTemplate(`
-# Interface to jump a spacecraft to another point in space. The
-# FTL Drive is the propulsion system to achieve faster-than-light
-# travel through space. A ship making a properly calculated
-# jump can arrive safely in planetary orbit, or alongside other
-# ships or spaceborne objects.
-interface org.example.ftl
-
-# The current state of the FTL drive and the amount of fuel
-# available to jump.
-type DriveCondition (
- state: (idle, spooling, busy),
- booster: bool,
- active_engines: [](id: int, state: bool),
- tylium_level: int
-)
-
-# Speed, trajectory and jump duration is calculated prior to
-# activating the FTL drive.
-type DriveConfiguration (
- speed: int,
- trajectory: int,
- duration: int
-)
-
-# The galactic coordinates use the Sun as the origin. Galactic
-# longitude is measured with primary direction from the Sun to
-# the center of the galaxy in the galactic plane, while the
-# galactic latitude measures the angle of the object above the
-# galactic plane.
-type Coordinate (
- longitude: float,
- latitude: float,
- distance: int
-)
-
-# Monitor the drive. The method will reply with an update whenever
-# the drive's state changes
-method Monitor() -> (condition: DriveCondition)
-
-# Calculate the drive's jump parameters from the current
-# position to the target position in the galaxy
-method CalculateConfiguration(
- current: Coordinate,
- target: Coordinate
-) -> (configuration: DriveConfiguration)
-
-# Jump to the calculated point in space
-method Jump(configuration: DriveConfiguration) -> ()
-
-# There is not enough tylium to jump with the given parameters
-error NotEnoughEnergy ()
-
-# The supplied parameters are outside the supported range
-error ParameterOutOfRange (field: string)
-
-# some more coverage
-method Foo(interface: string) -> (ret: (go: string, switch: bool, more: (t:bool, f:bool)))
- `)
-
- if err != nil {
- t.Fatalf("Error parsing %v", err)
- }
- expect(t, "orgexampleftl", pkgname)
- if len(b) <= 0 {
- t.Fatal("No generated go source")
- }
- // FIXME: compare b.String() against expected output
-}