### Install and Run h2i Source: https://github.com/golang/net/blob/master/http2/h2i/README.md Install h2i using 'go install' and run it by providing a hostname. ```bash $ go install golang.org/x/net/http2/h2i@latest $ h2i ``` -------------------------------- ### h2i Interactive Session Example Source: https://github.com/golang/net/blob/master/http2/h2i/README.md Demonstrates an interactive session with h2i, showing connection details, frame exchanges (SETTINGS, WINDOW_UPDATE, PING, HEADERS, DATA), and command inputs. ```bash $ h2i google.com Connecting to google.com:443 ... Connected to 74.125.224.41:443 Negotiated protocol "h2-14" [FrameHeader SETTINGS len=18] [MAX_CONCURRENT_STREAMS = 100] [INITIAL_WINDOW_SIZE = 1048576] [MAX_FRAME_SIZE = 16384] [FrameHeader WINDOW_UPDATE len=4] Window-Increment = 983041 h2i> PING h2iSayHI [FrameHeader PING flags=ACK len=8] Data = "h2iSayHI" h2i> headers (as HTTP/1.1)> GET / HTTP/1.1 (as HTTP/1.1)> Host: ip.appspot.com (as HTTP/1.1)> User-Agent: h2i/brad-n-blake (as HTTP/1.1)> Opening Stream-ID 1: :authority = ip.appspot.com :method = GET :path = / :scheme = https user-agent = h2i/brad-n-blake [FrameHeader HEADERS flags=END_HEADERS stream=1 len=77] :status = "200" alternate-protocol = "443:quic,p=1" content-length = "15" content-type = "text/html" date = "Fri, 01 May 2015 23:06:56 GMT" server = "Google Frontend" [FrameHeader DATA flags=END_STREAM stream=1 len=15] "173.164.155.78\n" [FrameHeader PING len=8] Data = "\x00\x00\x00\x00\x00\x00\x00\x00" h2i> ping [FrameHeader PING flags=ACK len=8] Data = "h2i_ping" h2i> ping [FrameHeader PING flags=ACK len=8] Data = "h2i_ping" h2i> ping [FrameHeader GOAWAY len=22] Last-Stream-ID = 1; Error-Code = PROTOCOL_ERROR (1) ReadFrame: EOF ``` -------------------------------- ### Basic Test Structure Example Source: https://github.com/golang/net/blob/master/html/testdata/html5lib-tests/tree-construction/README.md Illustrates the fundamental sections of a tree construction test case, including data, errors, and the expected document output. ```text #data

One

Two #errors 3: Missing document type declaration #document | | | |

| "One" |

| "Two" ``` -------------------------------- ### Example Struct Definition for Copying Source: https://github.com/golang/net/blob/master/html/testdata/go1.html This Go code defines a struct with both exported and unexported fields, along with a constructor function and a String method. It serves as an example for demonstrating the copying of structs with unexported fields. ```go type Struct struct { Public int secret int } func NewStruct(a int) Struct { // Note: not a pointer. return Struct{a, f(a)} } func (s Struct) String() string { return fmt.Sprintf("{%d (secret %d)}", s.Public, s.secret) } ``` -------------------------------- ### Basic Test Structure Source: https://github.com/golang/net/blob/master/html/testdata/html5lib-tests/tokenizer/README.md Defines the fundamental JSON structure for a single tokenizer test case. Includes fields for description, input, expected output, initial states, last start tag, and parse errors. ```json { "tests": [ { "description": "Test description", "input": "input_string", "output": [expected_output_tokens], "initialStates": [initial_states], "lastStartTag": last_start_tag, "errors": [parse_errors] } ] } ``` -------------------------------- ### Benchmark Functionality in Testing Package Source: https://github.com/golang/net/blob/master/html/testdata/go1.html This benchmark function demonstrates how to use `b.StopTimer()`, `b.StartTimer()`, and `b.Fatalf()` for verifying correctness and controlling timer during benchmark execution. ```go func BenchmarkSprintf(b *testing.B) { // Verify correctness before running benchmark. b.StopTimer() got := fmt.Sprintf("%x", 23) const expect = "17" if expect != got { b.Fatalf("expected %q; got %q", expect, got) } b.StartTimer() for i := 0; i < b.N; i++ { fmt.Sprintf("%x", 23) } } ``` -------------------------------- ### Walking Directory with path/filepath.WalkFunc Source: https://github.com/golang/net/blob/master/html/testdata/go1.html The path/filepath.Walk function now accepts a WalkFunc, which unifies handling for files and directories. Return filepath.SkipDir from the WalkFunc to skip a directory and its contents. ```go markFn := func(path string, info os.FileInfo, err error) error { if path == "pictures" { // Will skip walking of directory pictures and its contents. return filepath.SkipDir } if err != nil { return err } log.Println(path) return nil } err := filepath.Walk(".", markFn) if err != nil { log.Fatal(err) } ``` -------------------------------- ### Go 1 Goroutines During Init Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Illustrates how goroutines can be safely executed during program initialization in Go 1. This allows for concurrent operations during the init phase without deadlocks. ```go var PackageGlobal int func init() { c := make(chan int) go initializationFunction(c) PackageGlobal = <-c } ``` -------------------------------- ### Multiple assignment with array indexing (Go 1) Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Illustrates how multiple assignments work when left-hand side expressions involve array indexing. Right-hand side expressions are evaluated first, then assignments proceed left-to-right. ```go sa := []int{1, 2, 3} i := 0 i, sa[i] = 1, 2 // sets i = 1, sa[0] = 2 ``` ```go sb := []int{1, 2, 3} j := 0 sb[j], j = 2, 1 // sets sb[0] = 2, j = 1 ``` ```go sc := []int{1, 2, 3} sc[0], sc[0] = 1, 2 // sets sc[0] = 1, then sc[0] = 2 (so sc[0] = 2 at end) ``` -------------------------------- ### h2i Usage and Options Source: https://github.com/golang/net/blob/master/http2/h2i/README.md Displays the usage instructions and available command-line flags for h2i, including options for skipping TLS validation and specifying NPN/ALPN protocols. ```bash $ h2i Usage: h2i -insecure Whether to skip TLS cert validation -nextproto string Comma-separated list of NPN/ALPN protocol names to negotiate. (default "h2,h2-14") ``` -------------------------------- ### Struct and Array Equality in Go 1 Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Demonstrates how structs and arrays can be compared for equality and used as map keys in Go 1, provided their elements are comparable. This feature was not available before Go 1. ```go type Day struct { long string short string } Christmas := Day{"Christmas", "XMas"} Thanksgiving := Day{"Thanksgiving", "Turkey"} holiday := map[Day]bool{ Christmas: true, Thanksgiving: true, } fmt.Printf("Christmas is a holiday: %t\n", holiday[Christmas]) ``` -------------------------------- ### BPF Load Immediate Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads an immediate value into the accumulator register 'A'. Used for initializing values. ```bpf ld #42 ``` ```bpf ldx #42 ``` -------------------------------- ### Import Go Package with go/build Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use Import or ImportDir from the go/build package to retrieve information about Go packages. These functions replace FindTree and ScanDir. ```go pkg, err := build.Import("path/to/package", "", 0) ``` ```go pkgs, err := build.ImportDir("path/to/directory", 0) ``` -------------------------------- ### Iterate Files in token.FileSet Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use the Iterate method on token.FileSet to iterate over token.File elements. This replaces the older Files method that returned a channel. ```go fileset.Iterate(func(file *token.File) bool { ... }) ``` -------------------------------- ### URL Parsing in Go 1 Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Demonstrates how URLs with non-rooted paths are parsed in Go 1, introducing the Opaque field for encoded path data. ```go URL{ Scheme: "mailto", Opaque: "dev@golang.org", RawQuery: "subject=Hi", } ``` -------------------------------- ### Append bytes to a byte slice in Go Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Demonstrates appending bytes to a byte slice using the append function. This is a common pattern for generating output. ```go greeting := []byte{} greeting = append(greeting, []byte("hello ")...) ``` -------------------------------- ### Accessing Unix File Inode Number with os.FileInfo Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Demonstrates how to access system-specific file details, like the i-number on Unix systems, by type-asserting the result of the FileInfo.Sys() method. Ensure the target file is a Unix file before accessing system-specific attributes. ```go fi, err := os.Stat("hello.go") if err != nil { log.Fatal(err) } // Check that it's a Unix file. unixStat, ok := fi.Sys().(*syscall.Stat_t) if !ok { log.Fatal("hello.go: not a Unix file") } fmt.Printf("file i-number: %d\n", unixStat.Ino) ``` -------------------------------- ### BPF Load Scratch Register Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads a value from a scratch memory register into the accumulator or index register. Scratch registers are temporary storage. ```bpf ld M[3] ``` ```bpf ldx M[3] ``` -------------------------------- ### Append string to byte slice in Go 1 Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Introduced in Go 1, this shows how to append a string directly to a byte slice, simplifying conversions. ```go greeting = append(greeting, "world"...) ``` -------------------------------- ### Checking for File Existence Error with os.IsExist Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use the os.IsExist function to check for specific error conditions, such as a file already existing, when opening files. This provides a boolean check for common POSIX errors. ```go f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600) if os.IsExist(err) { log.Printf("%s already exists", name) } ``` -------------------------------- ### Parse Go File with go/parser Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use the primary ParseFile function from the go/parser package to parse a single Go source file. Convenience functions like ParseDir and ParseExpr are also available. ```go doc.New(pkg, importpath, mode) ``` -------------------------------- ### Tokenizer Token Output Formats Source: https://github.com/golang/net/blob/master/html/testdata/html5lib-tests/tokenizer/README.md Illustrates the expected formats for various tokenizer output tokens, including DOCTYPE, StartTag, EndTag, Comment, and Character tokens. Shows variations for self-closing tags and correctness flags. ```json ["DOCTYPE", name, public_id, system_id, correctness] ``` ```json ["StartTag", name, {attributes}*, true*] ``` ```json ["StartTag", name, {attributes}] ``` ```json ["EndTag", name] ``` ```json ["Comment", data] ``` ```json ["Character", data] ``` -------------------------------- ### BPF Return Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Terminates the BPF program execution. 'ret a' returns the value in the accumulator, 'ret #42' returns an immediate value. ```bpf prev: ret a ``` ```bpf end: ret #42 ``` -------------------------------- ### Receiving Specific Signals with os/signal.Notify Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Replaces the old signal.Incoming() function. Use signal.Notify to specify which signals should be delivered to a given channel. This allows for more selective signal handling. ```go c := make(chan os.Signal) signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT) ``` -------------------------------- ### Go 1 Composite Literals: Struct Initialization Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Demonstrates legal ways to initialize slices of structs using composite literals in Go 1. The type name can be elided for struct values and pointers. ```go type Date struct { month string day int } // Struct values, fully qualified; always legal. holiday1 := []Date{ Date{"Feb", 14}, Date{"Nov", 11}, Date{"Dec", 25}, } // Struct values, type name elided; always legal. holiday2 := []Date{ {"Feb", 14}, {"Nov", 11}, {"Dec", 25}, } // Pointers, fully qualified, always legal. holiday3 := []*Date{ &Date{"Feb", 14}, &Date{"Nov", 11}, &Date{"Dec", 25}, } // Pointers, type name elided; legal in Go 1. holiday4 := []*Date{ {"Feb", 14}, {"Nov", 11}, {"Dec", 25}, } ``` -------------------------------- ### BPF Load Extension Function Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads specific extension function identifiers into the accumulator. These are used to invoke specialized BPF helper functions. ```bpf ld #len ``` ```bpf ld #proto ``` ```bpf ld #type ``` ```bpf ld #rand ``` -------------------------------- ### BPF Store Scratch Register Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Stores the value from the accumulator or index register into a scratch memory register. Used for temporary data persistence. ```bpf st M[3] ``` ```bpf stx M[3] ``` -------------------------------- ### Delete from map using delete function (Go 1) Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use the `delete` built-in function to remove an entry from a map. Deleting a non-existent entry is a no-op. This replaces the older `m[k] = value, false` syntax. ```go delete(m, k) ``` -------------------------------- ### Create a new error value using errors.New Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use the `errors.New` function to create a simple error value from a string. This replaces the older `os.NewError` and provides a standard way to generate errors. ```go var ErrSyntax = errors.New("syntax error") ``` -------------------------------- ### BPF Arithmetic Operations with Constant Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Performs arithmetic operations (add, sub, mul, div, or, and, lsh, rsh, mod, xor) between the accumulator 'A' and an immediate constant. Results are stored in 'A'. ```bpf add #42 ``` ```bpf sub #42 ``` ```bpf mul #42 ``` ```bpf div #42 ``` ```bpf or #42 ``` ```bpf and #42 ``` ```bpf lsh #42 ``` ```bpf rsh #42 ``` ```bpf mod #42 ``` ```bpf xor #42 ``` -------------------------------- ### BPF Load Absolute Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads a byte, half-word, or word from an absolute memory address into the accumulator. Use with caution as it accesses memory directly. ```bpf ldb [42] ``` ```bpf ldh [42] ``` ```bpf ld [42] ``` -------------------------------- ### Google MinusOne Script Source: https://github.com/golang/net/blob/master/html/testdata/go1.html A JavaScript snippet for integrating Google's MinusOne service. It dynamically creates and appends a script tag to the document. ```javascript (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/minusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); ``` -------------------------------- ### BPF Arithmetic Operations with Register X Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Performs arithmetic operations (add, sub, mul, div, or, and, lsh, rsh, mod, xor) between the accumulator 'A' and the index register 'X'. Results are stored in 'A'. ```bpf add x ``` ```bpf sub x ``` ```bpf mul x ``` ```bpf div x ``` ```bpf or x ``` ```bpf and x ``` ```bpf lsh x ``` ```bpf rsh x ``` ```bpf mod x ``` ```bpf xor x ``` -------------------------------- ### Channel close operations in Go 1 Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Illustrates legal and illegal uses of the close function on channels. Go 1 disallows closing receive-only channels at compile time. ```go var c chan int var csend chan<- int = c var crecv <-chan int = c close(c) // legal close(csend) // legal close(crecv) // illegal ``` -------------------------------- ### Iterate over map with unpredictable order (Go 1) Source: https://github.com/golang/net/blob/master/html/testdata/go1.html When iterating over a map using a `for range` statement, the order of elements visited is unpredictable. Do not assume any specific iteration order. This change allows for better map balancing. ```go m := map[string]int{"Sunday": 0, "Monday": 1} for name, value := range m { // This loop should not assume Sunday will be visited first. f(name, value) } ``` -------------------------------- ### BPF Load IPv4 Header Length Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads the IPv4 header length into the index register 'X'. This is a specialized instruction for network packet processing. ```bpf ldx 4*([42]&0xf) ``` -------------------------------- ### BPF Jump Conditional with Constant Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Performs conditional jumps based on the comparison between the accumulator 'A' and an immediate constant. 'prev' and 'end' are labels. ```bpf ja end ``` ```bpf jeq #42,prev,end ``` ```bpf jne #42,end ``` ```bpf jlt #42,end ``` ```bpf jle #42,end ``` ```bpf jgt #42,prev,end ``` ```bpf jge #42,prev,end ``` ```bpf jset #42,prev,end ``` -------------------------------- ### Sleep until a specific time in Go Source: https://github.com/golang/net/blob/master/html/testdata/go1.html This function sleeps until the specified time. It returns immediately if the wakeup time has already passed. It calculates the duration until the wakeup time and uses time.Sleep. ```go // sleepUntil sleeps until the specified time. It returns immediately if it's too late. func sleepUntil(wakeup time.Time) { now := time.Now() // A Time. if !wakeup.After(now) { return } delta := wakeup.Sub(now) // A Duration. fmt.Printf("Sleeping for %.3fs\n", delta.Seconds()) time.Sleep(delta) } ``` -------------------------------- ### Go 1 Rune Type for Unicode Characters Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Shows the usage of the 'rune' type, an alias for int32, to represent Unicode code points in Go 1. Character literals default to type 'rune'. ```go delta := 'δ' // delta has type rune. var DELTA rune DELTA = unicode.ToUpper(delta) epsilon := unicode.ToLower(DELTA + 1) if epsilon != 'δ'+1 { log.Fatal("inconsistent casing for Greek") } ``` -------------------------------- ### Copying Structs with Unexported Fields in Go 1 Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Go 1 allows packages to copy struct values containing unexported fields from other packages. This enables new API patterns, such as returning opaque values without pointers or interfaces. ```go import "p" myStruct := p.NewStruct(23) copyOfMyStruct := myStruct fmt.Println(myStruct, copyOfMyStruct) ``` -------------------------------- ### Define Duration Flag in Go Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Use flag.Duration to define flags that accept time intervals. Values must include units like 's' for seconds or 'h' for hours. ```go var timeout = flag.Duration("timeout", 30*time.Second, "how long to wait for completion") ``` -------------------------------- ### BPF Load Indirect Instructions Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Loads a byte, half-word, or word from a memory address calculated by adding an offset to the index register 'X'. Useful for accessing data relative to a pointer. ```bpf ldb [x + 42] ``` ```bpf ldh [x + 42] ``` ```bpf ld [x + 42] ``` -------------------------------- ### BPF Jump Conditional with Register X Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Performs conditional jumps based on the comparison between the accumulator 'A' and the index register 'X'. 'prev' and 'end' are labels. ```bpf jeq x,prev,end ``` ```bpf jne x,end ``` ```bpf jlt x,end ``` ```bpf jle x,end ``` ```bpf jgt x,prev,end ``` ```bpf jge x,prev,end ``` ```bpf jset x,prev,end ``` -------------------------------- ### XML Violation Test Structure Source: https://github.com/golang/net/blob/master/html/testdata/html5lib-tests/tokenizer/README.md Shows the specific JSON structure used for XML violation tests, where the top-level key is 'xmlViolationTests' instead of 'tests'. Expected output assumes specific DOM coercion rules. ```json { "xmlViolationTests": [ { "description": "Test description", "input": "input_string", "output": [expected_output_tokens], "initialStates": [initial_states], "lastStartTag": last_start_tag, "errors": [parse_errors] } ] } ``` -------------------------------- ### Set Page Character Encoding with Meta Tag Source: https://github.com/golang/net/blob/master/html/charset/testdata/meta-content-attribute.html Use the meta element with http-equiv and content attributes to declare the character encoding of an HTML page. Ensure this is the only character encoding declaration. ```html ``` -------------------------------- ### Go 1 Compiler Rejection of Shadowed Return Values Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Functions with named return values will be rejected by the Go 1 compiler if a return statement without arguments is used when any named return value is shadowed in an inner scope. This ensures explicit handling of return values in such cases. ```go func Bug() (i, j, k int) { for i = 0; i < 5; i++ { for j := 0; j < 5; j++ { // Redeclares j. k += i*j if k > 100 { return // Rejected: j is shadowed here. } } } return // OK: j is not shadowed here. } ``` -------------------------------- ### Test UTF-16LE BOM Recognition Source: https://github.com/golang/net/blob/master/html/charset/testdata/UTF-16LE-BOM.html This JavaScript test verifies that a page with no explicit encoding declarations, but a UTF-16 little-endian BOM, is correctly identified as UTF-16. This is crucial for ensuring proper character rendering. ```javascript test(function () { assert_equals(document.getElementById('box').offsetWidth, 100); }, 'A page with no encoding declarations, but with a UTF-16 little-endian BOM will be recognized as UTF-16.'); ``` -------------------------------- ### HTML Meta Charset Declaration Source: https://github.com/golang/net/blob/master/html/charset/testdata/meta-charset-attribute.html Use this meta tag to declare the character encoding of an HTML document. Ensure it is placed within the head section. ```html ``` -------------------------------- ### Google Analytics Script Source: https://github.com/golang/net/blob/master/html/testdata/go1.html A JavaScript snippet for integrating Google Analytics tracking into a web page. It dynamically creates and appends a script tag to the document. ```javascript (function() { var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true; ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s); })(); ``` -------------------------------- ### BPF Register Transfers Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Transfers values between the accumulator 'A' and the index register 'X'. 'tax' transfers A to X, 'txa' transfers X to A. ```bpf tax ``` ```bpf txa ``` -------------------------------- ### Define a custom error type in Go Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Implement the `error` interface by defining a struct and a method named `Error()` that returns a string representation. This is necessary for custom error types in Go 1 and later. ```go type SyntaxError struct { File string Line int Message string } func (se *SyntaxError) Error() string { return fmt.Sprintf("%s:%d: %s", se.File, se.Line, se.Message) } ``` -------------------------------- ### JavaScript Test for UTF-16BE BOM Recognition Source: https://github.com/golang/net/blob/master/html/charset/testdata/UTF-16BE-BOM.html This test verifies that a page with no explicit encoding declarations but a UTF-16BE BOM is correctly identified as UTF-16. This is crucial for ensuring that character encoding is handled properly by the browser. ```javascript test(function () { assert_equals(document.getElementById('box').offsetWidth, 100); }, 'A page with no encoding declarations, but with a UTF-16 little-endian BOM will be recognized as UTF-16.'); ``` -------------------------------- ### Go 1 Error Type Definition Source: https://github.com/golang/net/blob/master/html/testdata/go1.html Defines the new built-in 'error' interface introduced in Go 1. This interface requires an 'Error()' string method for error handling. ```go type error interface { Error() string } ``` -------------------------------- ### BPF Negate Accumulator Source: https://github.com/golang/net/blob/master/bpf/testdata/all_instructions.txt Negates the value in the accumulator register 'A'. This is a unary operation. ```bpf neg ``` -------------------------------- ### CSS Selector with Special Characters Source: https://github.com/golang/net/blob/master/html/charset/testdata/No-encoding-declaration.html This CSS snippet defines a class name containing characters that have different byte representations in ISO 8859-15, ISO 8859-1, and UTF-8. It is used to test UTF-8 interpretation when no encoding declaration is present. ```css .test div { width: 50px; } ``` -------------------------------- ### JavaScript Test Assertion Source: https://github.com/golang/net/blob/master/html/charset/testdata/No-encoding-declaration.html This JavaScript code performs an assertion within a test function. It checks if the offsetWidth of an element with the ID 'box' is equal to 100. This is part of a larger test suite verifying browser behavior. ```javascript test(function() { assert_equals(document.getElementById('box').offsetWidth, 100); }, " "); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.