Skip to content
Snippets Groups Projects
Select Git revision
  • a05689932e1b4abf699e52a3d3271a891c1300ce
  • master default protected
  • 1.4.0
  • v1.3.0
4 results

main_windows_test.go

Blame
  • user avatar
    Neil Pankey authored
    f8d6195e
    History
    main_windows_test.go 1.14 KiB
    // +build windows
    
    package main
    
    import (
    	"log"
    )
    
    func ExampleMain_pass() {
    	exit := realMain([]string{"-s", "testdata\\schema.json", "testdata\\data-pass.json"})
    	if exit != 0 {
    		log.Fatalf("exit: got %d, want 0", exit)
    	}
    	// Output:
    	// testdata\data-pass.json: pass
    }
    
    func ExampleMain_fail() {
    	exit := realMain([]string{"-q", "-s", "testdata\\schema.json", "testdata\\data-fail.json"})
    	if exit != 1 {
    		log.Fatalf("exit: got %d, want 1", exit)
    	}
    	// Output:
    	// testdata\data-fail.json: fail: (root): foo is required
    }
    
    func ExampleMain_error() {
    	exit := realMain([]string{"-q", "-s", "testdata\\schema.json", "testdata\\data-error.json"})
    	if exit != 2 {
    		log.Fatalf("exit: got %d, want 2", exit)
    	}
    	// Output:
    	// testdata\data-error.json: error: invalid character 'o' in literal null (expecting 'u')
    }
    
    func ExampleMain_glob() {
    	exit := realMain([]string{"-q", "-s", "testdata\\schema.json", "testdata\\data-*.json"})
    	if exit != 3 {
    		log.Fatalf("exit: got %d, want 3", exit)
    	}
    	// Unordered output:
    	// testdata\data-error.json: error: invalid character 'o' in literal null (expecting 'u')
    	// testdata\data-fail.json: fail: (root): foo is required
    }