forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
102 additions
and
10 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
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
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,49 @@ | ||
package main | ||
|
||
import ( | ||
"path" | ||
"testing" | ||
) | ||
|
||
func AssertEqual(t *testing.T, actual string, expected string) { | ||
if actual != expected { | ||
t.Fatalf("not equal <<%s>> <<%s>>", actual, expected) | ||
} | ||
} | ||
|
||
func TestResolveModule(t *testing.T) { | ||
moduleName, filename, err := ResolveModule( | ||
"http:https://localhost:4545/testdata/subdir/print_hello.ts", | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/006_url_imports.ts") | ||
if err != nil { | ||
t.Fatalf(err.Error()) | ||
} | ||
AssertEqual(t, moduleName, | ||
"http:https://localhost:4545/testdata/subdir/print_hello.ts") | ||
AssertEqual(t, filename, | ||
path.Join(SrcDir, "localhost:4545/testdata/subdir/print_hello.ts")) | ||
|
||
moduleName, filename, err = ResolveModule( | ||
"./subdir/print_hello.ts", | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/006_url_imports.ts") | ||
if err != nil { | ||
t.Fatalf(err.Error()) | ||
} | ||
AssertEqual(t, moduleName, | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/subdir/print_hello.ts") | ||
AssertEqual(t, filename, | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/subdir/print_hello.ts") | ||
|
||
// In the case where the containingFile is a directory (indicated with a | ||
// trailing slash) | ||
moduleName, filename, err = ResolveModule( | ||
"testdata/001_hello.js", | ||
"/Users/rld/go/src/github.com/ry/deno/") | ||
if err != nil { | ||
t.Fatalf(err.Error()) | ||
} | ||
AssertEqual(t, moduleName, | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/001_hello.js") | ||
AssertEqual(t, filename, | ||
"/Users/rld/go/src/github.com/ry/deno/testdata/001_hello.js") | ||
} |
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
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
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,8 @@ | ||
export type TypedArray = Uint8Array | Float32Array | Int32Array; | ||
|
||
export interface ModuleInfo { | ||
moduleName?: string; | ||
filename?: string; | ||
sourceCode?: string; | ||
outputCode?: string; | ||
} |
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 @@ | ||
package main | ||
|
||
func Assert(cond bool, msg string) { | ||
if !cond { | ||
panic(msg) | ||
} | ||
} |
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